Using geo_bounding_box under a should query


What i am Ultimately trying to achieve is, checking if a document location cords is within any of 2 different geo bounding boxes.

In the Documentation i can see a usage example of geo_bounding_box under a filter query,
which works fine.
But, I have been trying to use geo_bounding_box under a should query with no success. see error below.

The only thing i changed from the example is wrote should instead of filter
from my past experience with elastic this works fine with any other type of query (terms, term, range etc)
but it seems geo_bounding_Box is acting different

GET /_search
"query": {
    "bool" : {
        "**should**" : {
            "geo_bounding_box" : {
                "pin.location" : {
                    "top_left" : {
                        "lat" : 40.73,
                        "lon" : -74.1
                    "bottom_right" : {
                        "lat" : 40.01,
                        "lon" : -71.12


im getting #<NoMethodError: undefined method 'geo_bounding_box' for

Why is that? isn't it possible to use geo queries under a should statement?
if not how can i achieve my goal?

Will appreciate any help,


I have tried to reproduce locally your issue and I couldn't. Which version of Elasticsearch are you running on?

Thanks for the answer.
actually this is working.

The query i had trouble composing is one that checked if a document falls within 1 of 2 geo bounding boxes. having trouble understanding what i need to do

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