Trait elastic_types::geo::shape::mapping::GeoShapeMapping [] [src]

pub trait GeoShapeMapping where
    Self: Default
{ fn tree() -> Option<Tree> { ... }
fn precision() -> Option<Distance> { ... }
fn tree_levels() -> Option<i32> { ... }
fn strategy() -> Option<Strategy> { ... }
fn distance_error_pct() -> Option<f32> { ... }
fn orientation() -> Option<Orientation> { ... }
fn points_only() -> Option<bool> { ... } }

The base requirements for mapping a geo_shape type.

Custom mappings can be defined by implementing GeoShapeMapping.

Examples

Define a custom GeoShapeMapping:

#[derive(Default)]
struct MyGeoShapeMapping;
impl GeoShapeMapping for MyGeoShapeMapping {
    //Overload the mapping functions here
    fn tree_levels() -> Option<i32> {
        Some(2)
    }
}

This will produce the following mapping:

#[derive(Default)]
{
    "type": "geo_shape",
    "tree_levels": 2
}

Provided Methods

Name of the PrefixTree implementation to be used: geohash for GeohashPrefixTree and quadtree for QuadPrefixTree.

This parameter may be used instead of tree_levels to set an appropriate value for the tree_levels parameter. The value specifies the desired precision and Elasticsearch will calculate the best tree_levels value to honor this precision. The value should be a number followed by an optional distance unit.

Maximum number of layers to be used by the PrefixTree. This can be used to control the precision of shape representations and therefore how many terms are indexed. Defaults to the default value of the chosen PrefixTree implementation. Since this parameter requires a certain level of understanding of the underlying implementation, users may use the precision parameter instead. However, Elasticsearch only uses the tree_levels parameter internally and this is what is returned via the mapping API even if you use the precision parameter.

The strategy parameter defines the approach for how to represent shapes at indexing and search time. It also influences the capabilities available so it is recommended to let Elasticsearch set this parameter automatically. There are two strategies available: recursive and term. Term strategy supports point types only (the points_only parameter will be automatically set to true) while Recursive strategy supports all shape types.

Used as a hint to the PrefixTree about how precise it should be. Defaults to 0.025 (2.5%) with 0.5 as the maximum supported value.

PERFORMANCE NOTE: This value will default to 0 if a precision or tree_level definition is explicitly defined. This guarantees spatial precision at the level defined in the mapping. This can lead to significant memory usage for high resolution shapes with low error (e.g., large shapes at 1m with < 0.001 error). To improve indexing performance (at the cost of query accuracy) explicitly define tree_level or precision along with a reasonable distance_error_pct, noting that large shapes will have greater false positives.

Setting this parameter in the geo_shape mapping explicitly sets vertex order for the coordinate list of a geo_shape field but can be overridden in each individual GeoJSON document.

Setting this option to true (defaults to false) configures the geo_shape field type for point shapes only (NOTE: Multi-Points are not yet supported). This optimizes index and search performance for the geohash and quadtree when it is known that only points will be indexed. At present geo_shape queries can not be executed on geo_point field types. This option bridges the gap by improving point performance on a geo_shape field so that geo_shape queries are optimal on a point only field.

Implementors