Class ContextMapping<T extends org.elasticsearch.common.xcontent.ToXContent>

org.elasticsearch.search.suggest.completion.context.ContextMapping<T>
All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment
Direct Known Subclasses:
CategoryContextMapping, GeoContextMapping

public abstract class ContextMapping<T extends org.elasticsearch.common.xcontent.ToXContent> extends implements org.elasticsearch.common.xcontent.ToXContentFragment
A ContextMapping defines criteria that can be used to filter and/or boost suggestions at query time for CompletionFieldMapper. Implementations have to define how contexts are parsed at query/index time
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static
     
    static
     
    protected
     
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Define a new context mapping of a specific type
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     o)
     
    protected abstract T
    fromXContent​(org.elasticsearch.common.xcontent.XContentParser context)
    Prototype for the query context
    int
     
     
    protected abstract <>
    Retrieves a set of context from a document at index-time.
    abstract <>
    parseContext​(ParseContext parseContext, org.elasticsearch.common.xcontent.XContentParser parser)
    Parses a set of index-time contexts.
    parseQueryContext​(org.elasticsearch.common.xcontent.XContentParser parser)
    Parses query contexts for this mapper
    protected abstract org.elasticsearch.common.xcontent.XContentBuilder
    toInnerXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
    Implementations should add specific configurations that need to be persisted
    <T> queryContexts)
    Convert query contexts to common representation
     
    org.elasticsearch.common.xcontent.XContentBuilder
    toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
     
    void
    validateReferences​(Version indexVersionCreated, <,​MappedFieldType> fieldResolver)
    Checks if the current context is consistent with the rest of the fields.

    Methods inherited from class java.lang.

    , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

  • Constructor Details

  • Method Details

    • type

      public ContextMapping.Type type()
      Returns:
      the type name of the context
    • name

      public  name()
      Returns:
      the name/id of the context
    • parseContext

      public abstract <> parseContext(ParseContext parseContext, org.elasticsearch.common.xcontent.XContentParser parser) throws , ElasticsearchParseException
      Parses a set of index-time contexts.
      Throws:
      ElasticsearchParseException
    • parseContext

      protected abstract <> parseContext(LuceneDocument document)
      Retrieves a set of context from a document at index-time.
    • fromXContent

      protected abstract T fromXContent(org.elasticsearch.common.xcontent.XContentParser context) throws
      Prototype for the query context
      Throws:
    • parseQueryContext

      public final <ContextMapping.InternalQueryContext> parseQueryContext(org.elasticsearch.common.xcontent.XContentParser parser) throws , ElasticsearchParseException
      Parses query contexts for this mapper
      Throws:
      ElasticsearchParseException
    • toInternalQueryContexts

      protected abstract <<T> queryContexts)
      Convert query contexts to common representation
    • toInnerXContent

      protected abstract org.elasticsearch.common.xcontent.XContentBuilder toInnerXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Implementations should add specific configurations that need to be persisted
      Throws:
    • validateReferences

      public void validateReferences(Version indexVersionCreated, <,​MappedFieldType> fieldResolver)
      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.
    • toXContent

      public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • equals

      public boolean equals( o)
      Overrides:
       in class 
    • hashCode

      public int hashCode()
      Overrides:
       in class 
    • toString

      public  toString()
      Overrides:
       in class