Class GeoContextMapping

org.elasticsearch.search.suggest.completion.context.ContextMapping<GeoQueryContext>
org.elasticsearch.search.suggest.completion.context.GeoContextMapping
All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class GeoContextMapping extends ContextMapping<GeoQueryContext>
A ContextMapping that uses a geo location/area as a criteria. The suggestions can be boosted and/or filtered depending on whether it falls within an area, represented by a query geo hash with a specified precision GeoQueryContext defines the options for constructing a unit of query context for this context type
  • Field Details

  • Method Details

    • getFieldName

      public  getFieldName()
    • getPrecision

      public int getPrecision()
    • load

      protected static  name, <,​> config)
    • toInnerXContent

      protected org.elasticsearch.common.xcontent.XContentBuilder toInnerXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Description copied from class: ContextMapping
      Implementations should add specific configurations that need to be persisted
      Specified by:
      toInnerXContent in class ContextMapping<GeoQueryContext>
      Throws:
    • parseContext

      public <> parseContext(ParseContext parseContext, org.elasticsearch.common.xcontent.XContentParser parser) throws , ElasticsearchParseException
      Parse a set of contexts at index-time. Acceptable formats:
      • Array:
        [<GEO POINT>, ..]
      • String/Object/Array:
        "GEO POINT"
      see GeoPoint(String) for GEO POINT
      Specified by:
      parseContext in class ContextMapping<GeoQueryContext>
      Throws:
      ElasticsearchParseException
    • parseContext

      public <> parseContext(LuceneDocument document)
      Description copied from class: ContextMapping
      Retrieves a set of context from a document at index-time.
      Specified by:
      parseContext in class ContextMapping<GeoQueryContext>
    • fromXContent

      protected GeoQueryContext fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws
      Description copied from class: ContextMapping
      Prototype for the query context
      Specified by:
      fromXContent in class ContextMapping<GeoQueryContext>
      Throws:
    • toInternalQueryContexts

      public <<GeoQueryContext> queryContexts)
      Parse a list of GeoQueryContext using parser. A QueryContexts accepts one of the following forms:
      • Object: GeoQueryContext
      • String: GeoQueryContext value with boost=1 precision=PRECISION neighbours=[PRECISION]
      • Array:
        [GeoQueryContext, ..]
      A GeoQueryContext has one of the following forms:
      • Object:
        • GEO POINT
        • {"lat": <double>, "lon": <double>, "precision":
                   <int>, "neighbours": <[int, ..]>}
        • {"context": <string>, "boost": <int>, "precision":
                   <int>, "neighbours": <[int, ..]>}
        • {"context": <GEO POINT>, "boost": <int>, "precision":
                   <int>, "neighbours": <[int, ..]>}
      • String:
        GEO POINT
      see GeoPoint(String) for GEO POINT
      Specified by:
      toInternalQueryContexts in class ContextMapping<GeoQueryContext>
    • validateReferences

      public void validateReferences(Version indexVersionCreated, <,​MappedFieldType> fieldResolver)
      Description copied from class: ContextMapping
      Checks if the current context is consistent with the rest of the fields. For example, the GeoContext should check that the field that it points to has the correct type.
      Overrides:
      validateReferences in class ContextMapping<GeoQueryContext>
    • equals

      public boolean equals( o)
      Overrides:
      equals in class ContextMapping<GeoQueryContext>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ContextMapping<GeoQueryContext>