Reputation: 184
Anyone knows if it is possible to do the following search in elasticsearch without using scripts.
Any suggestion it is welcome, as I couldn't find anything in the documentation.
{
"query": {
"match": {
"brands.*.shirts.colors": "red"
}
}
}
brands: arrays of objects of brand
*: any object of brand object
colors: array of colors
ps: the structure is merely illustrative.
Upvotes: 0
Views: 40
Reputation: 184
Improving the answer of Val I got the code that works.
{
"query": {
"query_string": {
"fields": ["brands.*.shirts.colors"],
"query": "red"
}
}
}
Upvotes: 0
Reputation: 217274
Try with query_string
like this:
{
"query": {
"query_string": {
"query": "brands.\*.shirts.colors:red"
}
}
}
Upvotes: 1