Package org.elasticsearch.index.mapper
Class SearchAsYouTypeFieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<Mapper>,ToXContent,ToXContentFragment
public class SearchAsYouTypeFieldMapper extends 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 classSearchAsYouTypeFieldMapper.Builderstatic classSearchAsYouTypeFieldMapper.Defaultsstatic classSearchAsYouTypeFieldMapper.TypeParserNested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper
FieldMapper.CopyTo, FieldMapper.MultiFieldsNested classes/interfaces inherited from class org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContextNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTENT_TYPEFields inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, fieldType, IGNORE_MALFORMED_SETTING, mappedFieldType, multiFields -
Constructor Summary
Constructors Constructor Description SearchAsYouTypeFieldMapper(java.lang.String simpleName, FieldType fieldType, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType mappedFieldType, FieldMapper.CopyTo copyTo, int maxShingleSize, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper prefixField, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields) -
Method Summary
Modifier and Type Method Description protected java.lang.StringcontentType()protected voiddoXContentBody(XContentBuilder builder, boolean includeDefaults, ToXContent.Params params)org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldTypefieldType()static java.lang.StringgetShingleFieldName(java.lang.String parentField, int shingleSize)java.util.Iterator<Mapper>iterator()intmaxShingleSize()protected voidmergeOptions(FieldMapper other, java.util.List<java.lang.String> conflicts)protected voidparseCreateField(ParseContext context)org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapperprefixField()org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[]shingleFields()Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
clone, copyTo, createFieldNamesField, docValuesByDefault, doXContentAnalyzers, indexedByDefault, indexOptionToString, merge, name, parse, parsesArrayValue, storedByDefault, termVectorOptionsToString, toXContent, typeName
-
Field Details
-
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPE- See Also:
- Constant Field Values
-
-
Constructor Details
-
SearchAsYouTypeFieldMapper
public SearchAsYouTypeFieldMapper(java.lang.String simpleName, FieldType fieldType, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType mappedFieldType, FieldMapper.CopyTo copyTo, int maxShingleSize, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.PrefixFieldMapper prefixField, org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields)
-
-
Method Details
-
parseCreateField
- Specified by:
parseCreateFieldin classFieldMapper- Throws:
java.io.IOException
-
contentType
protected java.lang.String contentType()- Specified by:
contentTypein classFieldMapper
-
mergeOptions
- Specified by:
mergeOptionsin classFieldMapper
-
getShingleFieldName
public static java.lang.String getShingleFieldName(java.lang.String parentField, int shingleSize) -
fieldType
public org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.SearchAsYouTypeFieldType fieldType()- Overrides:
fieldTypein classFieldMapper
-
maxShingleSize
public int maxShingleSize() -
prefixField
-
shingleFields
public org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper.ShingleFieldMapper[] shingleFields() -
doXContentBody
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, ToXContent.Params params) throws java.io.IOException- Overrides:
doXContentBodyin classFieldMapper- Throws:
java.io.IOException
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<Mapper>- Overrides:
iteratorin classFieldMapper
-