New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEO] Add new geo_bounding_box field type #27902
Conversation
@jpountz This still has dateline crossing. Wanted you to have a look before I completely take it out to get your thoughts on whether its as bad as I think. If we can keep dateline crossing out of lucene and achieve it here without any serious performance issues it might be worth it? |
@elasticmachine please test this |
Looking at the code, I have two concerns. One is that we might create slow queries sometimes due to |
Another (unrelated) thing that caught my attention is that the PR as-is needs to perform instanceof checks in |
I just added a
Haven't looked at a solution to this problem yet, but I think the
👍 Will add this next |
a2acada
to
be57cd2
Compare
I'm not a fan of the My preference would be to reject boxes that cross the dateline and have all relations implemented in a fast way, so that it would be complementary of the upcoming |
I am not completely opposed that, but unfortunately we face the same multivalue and dateline issue with
I sort of viewed this as a parallel to the problem with phrase queries over multivalue text fields. There we use a |
If we want to support all relations, I think we need to rework the encoding. Trying to hack it on top of the existing LatLonBoundingBox, which only supports INTERSECTS is going to be painful in the long term I'm afraid? For instance we discussed doubling the encoding space for the longitude at some point, I think this is one option? From what I remember we mostly didn't do it in order to have the same encoding as LatLonPoint. Some questions that this discussion triggered for me:
I'm pretty open regarding where we are moving this forward, however one thing that I care about is that we do end up with exposing some features that perform linear scans under the hood. |
This commit adds a new GeoBoundingBoxFieldMapper to expose lucene's LatLonBoundingBoxField type. Creating a new bounding box field is done by using the new field type mapping: `geo_bounding_box`. The field currently takes no options, though a coerce and ignore_malformed options could be added later. Currently the only supported query is the GeoBoundingBoxQueryBuilder enabling users to query bounding boxes with other bounding boxes. Next steps include adding support for GeoPolygonQueryBuilder which would allow users to query bounding boxes with other random polygons.
…ssing boxes, or single value for dateline crossing boxes
4dc836a
to
cc11a9f
Compare
@jpountz I spoke w/ @clintongormley about this with respect to the roadmap. Per all discussions I've gone ahead and updated the PR as follows:
Aside from updating docs this PR is ready for another review to identify and clean up any gross or ill performing code. |
@clintongormley We talked about this at the meeting this morning. The big question is whether or not After thinking about this a little more: I can see the concern for adding a new bounding box field, only to remove it in a future version. That being said, I'm not sure what kind of response I'm going to get from the lucene community and/or how long it will take to settle on a design. So is this PR worth it as an interim stop-gap? I think @jpountz feels its not? And I don't know that anyone other than our hardcore GIS users would be upset if it doesn't land in 6.2. So it just boils down to answering whether or not its okay to add a new field if there's a possibility it will be removed in the future. Is there a precedence for something like this? @clintongormley what are your thoughts? I'm okay postponing this until we can decide the future of a spatial codec in Lucene. That will tell us whether or not this field will be deprecated/removed in a future release and we can decide the fate of |
Closing since we decided against a |
This PR adds a new
GeoBoundingBoxFieldMapper
to expose lucene'sLatLonBoundingBoxField
type. Creating a new bounding box field is done by using the new field type mapping:geo_bounding_box
. The field currently takes no options, thoughcoerce
andignore_malformed
options could be added later. Currently the only supported query is theGeoBoundingBoxQueryBuilder
enabling users to query bounding boxes with other bounding boxes. Next steps include adding support forGeoPolygonQueryBuilder
which would allow users to query bounding boxes with other random polygons.Current Features
geo_bounding_box
field mapper does not support indexing boxes that cross the datelinegeo_bounding_box
query builder does support querying with boxes that cross the dateline (includes boxes that touch the 180 meridian)INTERSECT
,WITHIN
,CONTAINS
,DISJOINT
relations supported exceptCONTAINS
with query boxes that cross the dateline (since dateline crossing boxes are not indexed)Todo