[−][src]Trait elastic_types::geo::point::mapping::GeoPointMapping
The base requirements for mapping a geo_point
type.
Examples
Define a custom GeoPointMapping
:
#[derive(Default)] struct MyGeoPointMapping; impl GeoPointMapping for MyGeoPointMapping { type Format = GeoPointArray; //Overload the mapping functions here fn geohash() -> Option<bool> { Some(true) } }
This will produce the following mapping:
{ "type": "geo_point", "geohash": true }
Map with a generic Format
You can use a generic input parameter to make your GeoPointMapping
work for any kind of
GeoPointFormat
:
#[derive(Default)] struct MyGeoPointMapping<F> { _marker: PhantomData<F> } impl <F: GeoPointFormat> GeoPointMapping for MyGeoPointMapping<F> { type Format = F; }
Associated Types
type Format: GeoPointFormat
The format used to serialise and deserialise the geo point.
The format isn't actually a part of the Elasticsearch mapping for a geo_point
,
but is included on the mapping to keep things consistent.
Provided methods
fn geohash() -> Option<bool>
Should the geo-point
also be indexed as a geohash in the .geohash
sub-field? Defaults to false
,
unless geohash_prefix
is true
.
fn geohash_precision() -> Option<Distance>
The maximum length of the geohash to use for the geohash and geohash_prefix
options.
fn geohash_prefix() -> Option<bool>
Should the geo-point
also be indexed as a geohash plus all its prefixes? Defaults to false
.
fn ignore_malformed() -> Option<bool>
If true
, malformed geo-points
are ignored.
If false
(default), malformed geo-points
throw an exception and reject the whole document.
fn lat_lon() -> Option<bool>
Should the geo-point
also be indexed as .lat
and .lon
sub-fields?
Accepts true
and false
(default).
Implementors
impl<TFormat> GeoPointMapping for DefaultGeoPointMapping<TFormat> where
TFormat: GeoPointFormat,
[src]
TFormat: GeoPointFormat,