Maruf
Maruf

Reputation: 900

Elasticsearch geo_bounding_box filter returns 0 results

Am experiencing a geo bounding box issue that returns 0 results no matter how I modify the query

This gist contains the setup and query along with a similar query that should work.

I've tested on ES 1.3.0 and 1.5.0

Am I missing something here?

Upvotes: 2

Views: 658

Answers (1)

schellingerht
schellingerht

Reputation: 5796

This solution works for me:

I get the bound coords from Google Maps API in the format northeast and southwest. This means of course that you have to use "top_right" and "bottom_left" in ElasticSearch.

QUERY:

GET /users/users/_search
{
    "query":
    {
        "filtered":
        {
            "filter":
            {
                "geo_bounding_box":
                {
                    "location":
                    {
                        "top_right":
                        {
                            "lat": 53.5551999,
                            "lon": 7.227510199999999
                        },
                        "bottom_left":
                        {
                            "lat": 50.75038379999999,
                            "lon": 3.357962
                        }
                    }
                }
            }
        }
    }
}

Upvotes: 3

Related Questions