Skip to content

GIS Query not working on ES as expected #9079

Closed
@andyboagra

Description

@andyboagra

Issue raised:
Below is my request/ response. I am puzzled why do i get a polygon returned when it does not intersect w/ envelope defined in request. What am i missing? Appreciate quick response. Thanks,
Andy

Request:

_search
{"size": 51000,"query": { "geo_shape": { "POLYS": {"shape": {"type": "envelope", "coordinates": [[-118.58, 35.32],[-118.68, 35.30]]}, "relation": "intersects"}}}}

Response:

"took" : 1172,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 94420,
"max_score" : 1.0,
"hits" : [ {
"_index" : "XXX",
"_type" : "XXX_data",
"_id" : "1234",
"_score" : 1.0,
"_source":{"POLYS":{"type":"Polygon","coordinates":[[[-117.7656797176,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176,35.2420721325]]]}, "STATE": "XX", "ID": 1234 ,"COUNTY_NAME": "YY"}]}
}, {
"_index" : "XXX",
"_type" : "XXX_data",
"_id" : "1235",
"_score" : 1.0,
....
....

_mapping?pretty'

{
"XXX" : {
"mappings" : {
"XXX_data" : {
"properties" : {
"COUNTY_NAME" : {
"type" : "string"
},
"ID" : {
"type" : "long"
},
"POLYS" : {
"type" : "geo_shape",
"tree" : "quadtree",
"tree_levels" : 26
},
"STATE" : {
"type" : "string"
}
}
}
}
}
}

Reply from Peter Johnson:
I tried to fix this but you're right, it seems to be a bug. I've attached a full bug report which you might want to add to a new github issue.

https://gist.github.com/anonymous/c250d602d1e7fe6d3655
https://gist.github.com/missinglink/6e96f06e9e6032aa6416

I also tried using 'geohash' instead of 'quadtree' with the same result.

-P
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f1c49b57-721d-4abd-bb1d-ac54631e543a%40googlegroups.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/GeoIndexing, search aggregations of geo points and shapes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions