Geo bounding box search across anti-meridian


(Andrei) #1

I'm testing the new geo-search in 0.10 and ran into an issue. It seems
that ES does not like bounding boxes that extend across the
antimeridian (180° meridian). If I specify a box with top left corner
to the left of the meridian, and bottom right on the right, it treats
it as if the box wrapped around the wrong (long) way around the Earth.

Example:

curl -XPUT 'http://localhost:9200/bug/' -d'{ index:
{ number_of_shards: 1, number_of_replicas: 0 } }'
curl -XPUT 'http://localhost:9200/bug/test/_mapping' -d '{
"test" : {
"properties" : {
"user" : {"type" : "string", "index" : "not_analyzed"},
"title" : {"type" : "string", "boost" : 2.0},
"notes" : {"type" : "string"},
"tags" : {"type" : "string", "index_name" : "tag"},
"created" : {"type" : "date", "format" : "YYYY-MM-DD
HH:mm:ss"},
"geo" : {"type" : "geo_point"},
"privacy" : {"type" : "integer"}
}
}
}'

curl -XPUT "http://localhost:9200/bug/test/1" -d'{"tags":
["geotagged", "w", "incendio", "puglia", "vacanze", "peschici",
"estate2007", "leconseguenzedellincendio"], "notes": "", "created":
"2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci",
"title": "incendio peschici", "geo": {"lat": 21.5, "lon": -158.2}}'

curl -XPUT "http://localhost:9200/bug/test/2" -d'{"tags":
["geotagged", "w", "incendio", "puglia", "vacanze", "peschici",
"estate2007", "leconseguenzedellincendio"], "notes": "", "created":
"2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci",
"title": "incendio peschici", "geo": {"lat": 29.5, "lon": -108.6}}'

curl -XPOST "http://localhost:9200/bug/test/_search?pretty=true" -d'
{
"query": {
"constant_score": {
"filter": {
"geo_bounding_box": {
"geo": {
"top_left" : {
"lat" : 32.5,
"lon" : 169.1
},
"bottom_right" : {
"lat" : 5.8,
"lon" : -140.6
}
}
}
}
}
}
}'

This should return document 1, but instead returns document 2.

-Andrei


(Clinton Gormley) #2

On Thu, 2010-09-09 at 09:15 -0700, Andrei wrote:

I'm testing the new geo-search in 0.10 and ran into an issue. It seems
that ES does not like bounding boxes that extend across the
antimeridian (180° meridian). If I specify a box with top left corner
to the left of the meridian, and bottom right on the right, it treats
it as if the box wrapped around the wrong (long) way around the Earth.

I think that's what is known as an edge case :slight_smile:

Would you mind opening an issue with a curl recreation?

thanks

Clint


(Andrei) #3

Yeah, falling off the end of the world.

Open:

-Andrei

On Sep 9, 9:25 am, Clinton Gormley clin...@iannounce.co.uk wrote:

I think that's what is known as an edge case :slight_smile:

Would you mind opening an issue with a curl recreation?

http://github.com/elasticsearch/elasticsearch/issues

thanks

Clint


(Shay Banon) #4

Hi,

Yea, it did not handle it correctly. I have just pushed a fix to it.

-shay.banon

On Thu, Sep 9, 2010 at 7:36 PM, Andrei andrei@zmievski.org wrote:

Yeah, falling off the end of the world.

Open:

http://github.com/elasticsearch/elasticsearch/issues/issue/363

-Andrei

On Sep 9, 9:25 am, Clinton Gormley clin...@iannounce.co.uk wrote:

I think that's what is known as an edge case :slight_smile:

Would you mind opening an issue with a curl recreation?

http://github.com/elasticsearch/elasticsearch/issues

thanks

Clint


(system) #5