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] GeoJSON parser doesn't support more than two elements in a position #9540
Comments
Thanks for reporting! While Elasticsearch doesn't spatially index anything beyond 2 dimension (yet) this is indeed a bug. Will look into throwing a warning that the z position will be ignored. The other option is to silently ignore it. |
@nknize I don't think that a warning in the logs is a good solution. The user causes this but putting a warning in logs will not inform the user that something is not right with the request, and even if it did, in many cases the user indexing the document will not have access to the log files. Also, if someone indexes a bulk load of document with extra dimensions they are going to create massive amounts of logs without any knowledge that there is any warnings. Throwing an exception gives the user feedback saying that something is not right. We need a solution here that is obvious to the user. Maybe something like having an option in the mapping to either throw an error on extra dimensions or to ignore them? |
Closes elastic#9540 Conflicts: src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java
Closes elastic#9540 Conflicts: src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java Conflicts: src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java
Closes elastic#9540 Conflicts: src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java Conflicts: src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java
Fixed in #10539 by silently ignoring values beyond the 2nd dimension. |
GeoJSON specification allows 2 or more elements for a position (x, y [z, ...]).
http://geojson.org/geojson-spec.html#positions
When trying to index a Polygon with coordinates containing more than 2 elements, Elasticsearch throws :
org.elasticsearch.ElasticsearchParseException: Invalid number of points in LinearRing (found 2 - must be >= 4)
Here the gist for a simple test :
https://gist.github.com/clement-tourriere/aa2abdc94de7d1456c58
The text was updated successfully, but these errors were encountered: