java.lang.Object
org.elasticsearch.common.geo.GenericPointParser<T>
- Type Parameters:
T
- type of point to produce (either geographic or cartesian)
This class can parse points from XContentParser and supports several formats:
-
Constructor Summary
ConstructorDescriptionGenericPointParser
(String mapType, String xField, String yField, boolean supportGeohash) Construct the parser with some configuration settings -
Method Summary
Modifier and TypeMethodDescriptionabstract void
assertZValue
(boolean ignoreZValue, double zValue) abstract T
createPoint
(double xValue, double yValue) abstract String
parsePoint
(XContentParser parser, boolean ignoreZValue, Function<String, T> fromString, Function<String, T> fromGeohash) Parse a Point with anXContentParser
.
-
Constructor Details
-
GenericPointParser
Construct the parser with some configuration settings- Parameters:
mapType
- whether the parser is for 'geo_point' or 'point'xField
- the name of the first coordinate when constructing points (either 'x' or 'lat')yField
- the name of the second coordinate when constructing points (either 'y' or 'lon')supportGeohash
- whether to support parsing geohash values (only geo_point supports this currently)
-
-
Method Details
-
assertZValue
public abstract void assertZValue(boolean ignoreZValue, double zValue) -
createPoint
-
fieldError
-
parsePoint
public T parsePoint(XContentParser parser, boolean ignoreZValue, Function<String, T> fromString, Function<String, throws IOException, ElasticsearchParseExceptionT> fromGeohash) Parse a Point with anXContentParser
.- Parameters:
parser
-XContentParser
to parse the value fromignoreZValue
-XContentParser
to not throw an error if 3 dimensional data is provided- Returns:
- new Point parsed from the parser
- Throws:
IOException
ElasticsearchParseException
-