Geo distance filter with multiple (must or should) keyword

I am using elasticsearch with bool/must/filter and in filter using the geo_distance filter. Here are some sample queries:

Example 1:
For this query as I am using only one must term with geo filter, I am able to get atleast 1 or more results.

curl -XPOST 'localhost:9200/indexname/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"bool" : {
"must": {
"term": { "name": "cafe" }
},
"filter": {
"geo_distance" : {
"distance" : "20km",
"pin.coordinates" : {
"lat" : 13.9291040000,
"lon" : -70.8269250000
}
}
}
}
}
}'

Example 2:

If I use multiple must or should along with the above query it is not displaying any hits/results

curl -XPOST 'localhost:9200/indexname/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"bool" : {
"must": {
"term": { "name": "cafe" }
},
"filter": {
"geo_distance" : {
"distance" : "20km",
"pin.coordinates" : {
"lat" : 13.9291040000,
"lon" : -70.8269250000
}
}
},
"should" : [
{ "term" : { "category_ol" : "cafe" } },
{ "term" : { "name_en" : "cafe" } }
],
"minimum_should_match" : 1,
"boost" : 1.0
}
}
}'

Anything wrong in the 2nd sample? Please give some solution. TIA

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.