Concave geo shapes in 1.7.x

I'm maintaining an application running 1.7.x that heavily uses geoshapes and querying by points within those shapes.

As far as I can tell 1.7.x is not handling concave shapes well and queries for shapes are returning points inside a concave area and not inside the shape itself.

I've read some of the 2.x docs that state there is better geoshape handling but nothing specifically about this issue. Does anyone know if this is fixed in 2.x?

I am no sure what you mean with concave geo shape and concave area. Could you provide an example and explain why is it not meeting your expectation?.

It would be good if you share as well how are you mapping those shapes.

Hi Ignatio, here's the example I'm having trouble with:

I'm using these two shapes for NY and CT:

South of bridgeport in CT sits in a little concave area of the overall NY shape and if I do a query using these filters inside that area in south CT (such as 41.1449699 -73.5651199), I get returns for both NY and CT data. I expect to get only CT data from this query since it's fully contained in the CT polygon and not inside the NY polygon.

    geo_shape: {
      shape: {
        shape: {
          coordinates: [
          type: 'point'

Keep in mind this is elasticsearch 1.7.5. I've tried a simple upgrade to 2.x and am getting the same results, so maybe you can tell me if I'm doing my query incorrectly?

This behaviour is expected, have a look at this post:

Thanks for the note @Ignacio_Vera! It looks like upgrading to 6.6+ and reindexing would resolve these issues - am I interpreting that correctly?

Yes, that is correct.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.