GIS Query not working on ES as expected

Hi,
I am new to GIS w/ ES.

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"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2d56bdd5-34a2-4066-a770-81dacb6be725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hey Andy,

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.

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

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

Hi,
I am new to GIS w/ ES.

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"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f1c49b57-721d-4abd-bb1d-ac54631e543a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

What i have is a simple test case for the feature (this is not a corner
case)....Is this feature expected to work in some other coordinate system?
Any workaround to overcome this bug? Thanks!
Andy

On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:

Hey Andy,

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.

map.geojson · GitHub
geo-intersects.sh · GitHub

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

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

Hi,
I am new to GIS w/ ES.

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"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0c965f6b-a837-4f30-a4ea-cffaad3f92dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Filed GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub
FYI!

On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:

What i have is a simple test case for the feature (this is not a corner
case)....Is this feature expected to work in some other coordinate system?
Any workaround to overcome this bug? Thanks!
Andy

On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:

Hey Andy,

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.

map.geojson · GitHub
geo-intersects.sh · GitHub

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

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

Hi,
I am new to GIS w/ ES.

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"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d649783c-baa8-4f38-8d36-cc1e2f07d36e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I think I figured out what's going on, see the github issue.

-P

On Sunday, 28 December 2014 05:21:07 UTC, AndyGIS wrote:

Filed GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub
FYI!

On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:

What i have is a simple test case for the feature (this is not a corner
case)....Is this feature expected to work in some other coordinate system?
Any workaround to overcome this bug? Thanks!
Andy

On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:

Hey Andy,

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.

map.geojson · GitHub
geo-intersects.sh · GitHub

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

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

Hi,
I am new to GIS w/ ES.

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"
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks Peter. Issue at this point is resolved. I will upload about half a
milion polygons and test further. Thanks for your help.

On Sun, Dec 28, 2014 at 10:29 AM, Peter Johnson peter@missinglink.co.nz
wrote:

I think I figured out what's going on, see the github issue.

-P

On Sunday, 28 December 2014 05:21:07 UTC, AndyGIS wrote:

Filed GIS Query not working on ES as expected · Issue #9079 · elastic/elasticsearch · GitHub
FYI!

On Saturday, December 27, 2014 9:07:50 PM UTC-8, AndyGIS wrote:

What i have is a simple test case for the feature (this is not a corner
case)....Is this feature expected to work in some other coordinate system?
Any workaround to overcome this bug? Thanks!
Andy

On Saturday, December 27, 2014 6:40:44 AM UTC-8, Peter Johnson wrote:

Hey Andy,

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.

map.geojson · GitHub
geo-intersects.sh · GitHub

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

-P

On Friday, 26 December 2014 22:51:56 UTC, AndyGIS wrote:

Hi,
I am new to GIS w/ ES.

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
<7656797176>,35.2420721325],[-117.766565557,35.2429646794],[-117.7675000712
<7675000712>,35.2429532681],[-117.7661768866,35.2415486409],[-117.7661640858,35.2415341862],[-117.765523769,35.2419167046],[-117.7656797176
<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"
}
}
}
}
}
}

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/AqVrhQ7UiG8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0b3a1d4f-7ad5-4163-947d-992a33b71ec7%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CADuvwZUUDq7CFgSONUaJOgvr6DNsr7zs8%3Dq0GJFC%2BxznBhr%2BTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Nice. Out of curiosity are the polygons ope ndata? If so could you share the source please?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/112d8bf5-ecb1-40dd-bac3-b9ec5276615b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.