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