I am trying to search the documents using terms filter. I have an array of objects which in turn has a string and an array element. For example:
{
"shop" : {
"name" : "bay avenue store",
"brands": [
{
"name" : "coca-cola",
"items" : ["diet coke", "fanta", "coke-zero"]
},
{
"name" : "pepsi",
"items" : ["extra zero", "mountain dew"]
}
]
}
}
How do I use wildcard inside the "items". I am trying something like:
{
"query": {
"nested" : {
"path" : "brands",
"query" : {
"match" : {
{"brands.items": ["*zero"]}
}
}
}
}
}
Is this possible? Please suggest me with a solution.
Never mind, Found the solution after few hits and trails. Here goes..
"query": {
"nested": {
"path":"brands ",
"query":{
"wildcard":{
"brands.items":{
"value":"*zero*"
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With