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
NPE enclosed in a SearchParseException for a "point" type "geo_shape" filter or query #8432
Comments
Another NPE happens for a query type "polygon": {
"query": {
"geo_shape": {
"location": {
"shape": {
"type": "polygon",
"coordinates": ["4.901238","52.36936"]
}
}
}
}
} and the stacktrace:
|
@nknize can you take a look at this? |
The following is probably obvious (and likely the intent of the test): The GeoJSON in the query request is invalid. e.g., "shape": {
"type": "point",
"coordinates": [["4.901238","52.36936"]]
} Should either be: "type": "multipoint",
... or: ...
"coordinates": ["4.901238","52.36936"]} Same with the polygon - it should be an array of LinearRings (closed LineStrings). I'll add a more useful parse error message instead of the "give up" NPE. FYI, most of the shape parsing logic can use better error handling so I'm certain this isn't the last NPE parse error. I'll be adding better error handling as I go so add the issues as you find them. |
if ripping it out and redo is a potential better solution I am all for it @nknize especially if we can add unittests to it as well :) |
…filter or query This fix adds better error handling for parsing multipoint, linestring, and polygon GeoJSONs. Current logic throws a NPE when parsing a multipoint, linestring, or polygon that does not comply with the GeoJSON specification. That is, if a user provides a single coordinate instead of an array of coordinates, or array of linestrings, the ShapeParser throws a NPE wrapped in a SearchParseException instead of a more useful error message. Closes elastic#8432
…filter or query This fix adds better error handling for parsing multipoint, linestring, and polygon GeoJSONs. Current logic throws a NPE when parsing a multipoint, linestring, or polygon that does not comply with the GeoJSON specification. That is, if a user provides a single coordinate instead of an array of coordinates, or array of linestrings, the ShapeParser throws a NPE wrapped in a SearchParseException instead of a more useful error message. Closes #8432
…filter or query This fix adds better error handling for parsing multipoint, linestring, and polygon GeoJSONs. Current logic throws a NPE when parsing a multipoint, linestring, or polygon that does not comply with the GeoJSON specification. That is, if a user provides a single coordinate instead of an array of coordinates, or array of linestrings, the ShapeParser throws a NPE wrapped in a SearchParseException instead of a more useful error message. Closes #8432
…filter or query This fix adds better error handling for parsing multipoint, linestring, and polygon GeoJSONs. Current logic throws a NPE when parsing a multipoint, linestring, or polygon that does not comply with the GeoJSON specification. That is, if a user provides a single coordinate instead of an array of coordinates, or array of linestrings, the ShapeParser throws a NPE wrapped in a SearchParseException instead of a more useful error message. Closes elastic#8432
Given the following mapping and data:
The following query, either a "geo_shape" filter or query, fails with a SearchParseException enclosing a NullPointerException:
And the exception in logs:
The text was updated successfully, but these errors were encountered: