Navigation Menu

Skip to content
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

Closed
clement-tourriere opened this issue Feb 3, 2015 · 3 comments
Assignees
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v1.6.0 v2.0.0-beta1

Comments

@clement-tourriere
Copy link

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

@nknize
Copy link
Contributor

nknize commented Feb 3, 2015

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 nknize changed the title GeoJSON parser doesn't support more than two elements in a position [GEO] GeoJSON parser doesn't support more than two elements in a position Feb 3, 2015
@colings86
Copy link
Contributor

@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?

@spinscale spinscale added v1.4.5 and removed v1.4.4 labels Feb 19, 2015
clement-tourriere pushed a commit to clement-tourriere/elasticsearch that referenced this issue Mar 20, 2015
Closes elastic#9540

Conflicts:
	src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java
	src/test/java/org/elasticsearch/common/geo/GeoJSONShapeParserTests.java
clement-tourriere pushed a commit to opendatasoft/elasticsearch that referenced this issue Apr 2, 2015
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
clement-tourriere pushed a commit to opendatasoft/elasticsearch that referenced this issue Apr 2, 2015
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
@nknize
Copy link
Contributor

nknize commented Apr 20, 2015

Fixed in #10539 by silently ignoring values beyond the 2nd dimension.

@nknize nknize closed this as completed Apr 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v1.6.0 v2.0.0-beta1
Projects
None yet
6 participants