Class SearchAsYouTypeFieldMapper

java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper
All Implemented Interfaces:
Cloneable, Iterable<org.elasticsearch.index.mapper.Mapper>, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public class SearchAsYouTypeFieldMapper extends org.elasticsearch.index.mapper.FieldMapper
Mapper for a text field that optimizes itself for as-you-type completion by indexing its content into subfields. Each subfield modifies the analysis chain of the root field to index terms the user would create as they type out the value in the root field The structure of these fields is
     [ SearchAsYouTypeFieldMapper, SearchAsYouTypeFieldType, unmodified analysis ]
     ├── [ ShingleFieldMapper, ShingleFieldType, analysis wrapped with 2-shingles ]
     ├── ...
     ├── [ ShingleFieldMapper, ShingleFieldType, analysis wrapped with max_shingle_size-shingles ]
     └── [ PrefixFieldMapper, PrefixFieldType, analysis wrapped with max_shingle_size-shingles and edge-ngrams ]
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     

    Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper

    org.elasticsearch.index.mapper.FieldMapper.Conflicts, org.elasticsearch.index.mapper.FieldMapper.CopyTo, org.elasticsearch.index.mapper.FieldMapper.MergeValidator<T extends Object>, org.elasticsearch.index.mapper.FieldMapper.MultiFields, org.elasticsearch.index.mapper.FieldMapper.Parameter<T extends Object>, org.elasticsearch.index.mapper.FieldMapper.Serializer<T extends Object>, org.elasticsearch.index.mapper.FieldMapper.SerializerCheck<T extends Object>, org.elasticsearch.index.mapper.FieldMapper.TypeParser

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

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final org.elasticsearch.index.mapper.FieldMapper.TypeParser
     

    Fields inherited from class org.elasticsearch.index.mapper.FieldMapper

    COERCE_SETTING, copyTo, hasScript, IGNORE_MALFORMED_SETTING, indexAnalyzers, mappedFieldType, multiFields, onScriptError

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    SearchAsYouTypeFieldMapper(String simpleName, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType mappedFieldType, org.elasticsearch.index.mapper.FieldMapper.CopyTo copyTo, Map<String,org.elasticsearch.index.analysis.NamedAnalyzer> indexAnalyzers, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper prefixField, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields, SearchAsYouTypeFieldMapper.Builder builder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     
    org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType
     
    org.elasticsearch.index.mapper.FieldMapper.Builder
     
    static String
    getShingleFieldName(String parentField, int shingleSize)
     
    Iterator<org.elasticsearch.index.mapper.Mapper>
     
    int
     
    protected void
    parseCreateField(org.elasticsearch.index.mapper.DocumentParserContext context)
     
    org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper
     
    org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[]
     

    Methods inherited from class org.elasticsearch.index.mapper.FieldMapper

    checkIncomingMergeType, copyTo, doValidate, doXContentBody, executeScript, hasScript, indexAnalyzers, indexScriptValues, merge, multiFields, name, notInMultiFields, parse, parsesArrayValue, toXContent, typeName, validate

    Methods inherited from class org.elasticsearch.index.mapper.Mapper

    simpleName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • CONTENT_TYPE

      public static final String CONTENT_TYPE
      See Also:
    • PARSER

      public static final org.elasticsearch.index.mapper.FieldMapper.TypeParser PARSER
  • Constructor Details

    • SearchAsYouTypeFieldMapper

      public SearchAsYouTypeFieldMapper(String simpleName, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType mappedFieldType, org.elasticsearch.index.mapper.FieldMapper.CopyTo copyTo, Map<String,org.elasticsearch.index.analysis.NamedAnalyzer> indexAnalyzers, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper prefixField, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields, SearchAsYouTypeFieldMapper.Builder builder)
  • Method Details

    • parseCreateField

      protected void parseCreateField(org.elasticsearch.index.mapper.DocumentParserContext context) throws IOException
      Specified by:
      parseCreateField in class org.elasticsearch.index.mapper.FieldMapper
      Throws:
      IOException
    • contentType

      protected String contentType()
      Specified by:
      contentType in class org.elasticsearch.index.mapper.FieldMapper
    • getMergeBuilder

      public org.elasticsearch.index.mapper.FieldMapper.Builder getMergeBuilder()
      Specified by:
      getMergeBuilder in class org.elasticsearch.index.mapper.FieldMapper
    • getShingleFieldName

      public static String getShingleFieldName(String parentField, int shingleSize)
    • fieldType

      public org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType fieldType()
      Overrides:
      fieldType in class org.elasticsearch.index.mapper.FieldMapper
    • maxShingleSize

      public int maxShingleSize()
    • prefixField

      public org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper prefixField()
    • shingleFields

      public org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields()
    • iterator

      public Iterator<org.elasticsearch.index.mapper.Mapper> iterator()
      Specified by:
      iterator in interface Iterable<org.elasticsearch.index.mapper.Mapper>
      Overrides:
      iterator in class org.elasticsearch.index.mapper.FieldMapper