An example of more simple pre-indexed shapes filtering and more complex ones not filtering

Hello,

Using Elasticsearch and Kibana v7.5.2, I have encountered something unexpected while using pre-indexed shape filtering. I have it documented in a google doc -

The doc is split into 2 sections and the information required to replicate and the results are outlined. Here is a summary of what is happening:

  1. I create an index with a geo_point field, add one document and filter based on a bool should filter, where each polygon is part of the MultiPolygon that makes up the external bounds of the USA. All works well

a. I create an index with a shape field (shape field that is new to ES v7.4)
b. Add one document with a point within the external bounds of Ireland
c. Index the external bounds of Ireland and use a pre-indexed shape filter, the response includes the point within Ireland as expected. All works is well.
d. Add another document which has a point within the USA multipolygon
e. Index the external bounds of USA multipolygon and use a pre-indexed shape filter, the response does NOT include the point within USA as expected All does NOT work well

Considering that the Ireland pre-indexed shape works (as per point 2) AND when the shapes that make up the external bounds of the USA are used to filter on a polygon by polygon basis (as per point 1), the complexity of the USA external bounds may be causing problems for pre-indexed shape filters?

Best Regards,
Edwin

Hi,

I cannot access you document, would it be possible you share your example, maybe using something like GIST?

Hello Ignacio,

Thanks for quick reply, gist is here

Edwin

Investigating this a bit further, I find the expected result when using the geo_shape pre-indexed filter type:

POST companywithgeoshape/_doc/insideus
{
  "location": {
"type": "point",
"coordinates": [-100.0, 40.0]
  }
}

I had a look into you example and it seems the shape you are indexing in not USA but Canada, therefore the point is not inside:

Oh wow, my bad.

Thanks for quick reply Ignacio :blush:

1 Like

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