Query on Filtered query


(Pradeep Gupta) #1

we are trying below simple query. Here filter working as expected but query match_all = travel is not working. I am expecting that below query should first look for all documents having "travel" any where, then it should filter documents based on cityname and weather.

But results only shows documents from filtered section. Some how it is not executing query portion.

{
"query": {
"filtered": {
"query": {
"match": {
"_all": "travel"
},
"filter": {
"bool": {
"must": [
{
"terms": {
"cityname": [
"bangalore",
"delhi"
]
}
},
{
"terms": {
"weather": [
"winter",
"spring"
]
}
}
]
}
}
}
}
}
}


(David Pilato) #2

Hard to say without a full script.
May be mapping issue?

BTW I'd not use _all but copy_to feature instead.


(Pradeep Gupta) #3

i got the issue in my query. I had placed filter inside the query tag. But It should have been sibling to query as i wanted to use query and filter both together.


(system) #4