Package org.elasticsearch.index.mapper
Class CompletionFieldMapper
- java.lang.Object
-
- org.elasticsearch.index.mapper.Mapper
-
- org.elasticsearch.index.mapper.FieldMapper
-
- org.elasticsearch.index.mapper.CompletionFieldMapper
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<Mapper>
,ToXContent
,ToXContentFragment
,ArrayValueMapperParser
public class CompletionFieldMapper extends FieldMapper implements ArrayValueMapperParser
Mapper for completion field. The field values are indexed as a weighted FST for fast auto-completion/search-as-you-type functionality.
Type properties:
- "analyzer": "simple", (default)
- "search_analyzer": "simple", (default)
- "preserve_separators" : true, (default)
- "preserve_position_increments" : true (default)
- "min_input_length": 50 (default)
- "contexts" : CONTEXTS
ContextMappings.load(Object, Version)
for CONTEXTS
seeparse(ParseContext)
for acceptable inputs for indexing
This field type constructs completion queries that are run against the weighted FST index by the
CompletionSuggester
. This field can also be extended to add search criteria to suggestions for query-time filtering and boosting (seeContextMappings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CompletionFieldMapper.Builder
Builder forCompletionFieldMapper
static class
CompletionFieldMapper.CompletionFieldType
static class
CompletionFieldMapper.Defaults
static class
CompletionFieldMapper.Fields
static class
CompletionFieldMapper.TypeParser
-
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper
FieldMapper.CopyTo, FieldMapper.MultiFields
-
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContext
-
Nested 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.util.Set<java.lang.String>
ALLOWED_CONTENT_FIELD_NAMES
static java.lang.String
CONTENT_TYPE
-
Fields inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, defaultFieldType, fieldType, IGNORE_MALFORMED_SETTING, indexCreatedVersion, multiFields
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description CompletionFieldMapper(java.lang.String simpleName, MappedFieldType fieldType, Settings indexSettings, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo, int maxInputLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
contentType()
protected void
doMerge(Mapper mergeWith, boolean updateAllTypes)
Merge changes coming frommergeWith
in place.CompletionFieldMapper.CompletionFieldType
fieldType()
Mapper
parse(ParseContext context)
Parses and indexes inputs Parsing: Acceptable format: "STRING" - interpreted as field value (input) "ARRAY" - each element can be one of "OBJECT" (see below) "OBJECT" - { "input": STRING|ARRAY, "weight": STRING|INT, "contexts": ARRAY|OBJECT } Indexing: if context mappings are defined, delegates toContextMappings.addField(ParseContext.Document, String, String, int, Map)
else adds inputs as aSuggestField
protected void
parseCreateField(ParseContext context, java.util.List<org.apache.lucene.index.IndexableField> fields)
Parse the field value and populatefields
.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
-
Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
clone, copyTo, createFieldNamesField, doXContentAnalyzers, doXContentBody, doXContentDocValues, indexOptionToString, iterator, merge, name, termVectorOptionsToString, typeName, updateFieldType
-
Methods inherited from class org.elasticsearch.index.mapper.Mapper
simpleName
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPE
- See Also:
- Constant Field Values
-
ALLOWED_CONTENT_FIELD_NAMES
public static final java.util.Set<java.lang.String> ALLOWED_CONTENT_FIELD_NAMES
-
-
Constructor Detail
-
CompletionFieldMapper
public CompletionFieldMapper(java.lang.String simpleName, MappedFieldType fieldType, Settings indexSettings, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo, int maxInputLength)
-
-
Method Detail
-
fieldType
public CompletionFieldMapper.CompletionFieldType fieldType()
- Overrides:
fieldType
in classFieldMapper
-
parse
public Mapper parse(ParseContext context) throws java.io.IOException
Parses and indexes inputs Parsing: Acceptable format: "STRING" - interpreted as field value (input) "ARRAY" - each element can be one of "OBJECT" (see below) "OBJECT" - { "input": STRING|ARRAY, "weight": STRING|INT, "contexts": ARRAY|OBJECT } Indexing: if context mappings are defined, delegates toContextMappings.addField(ParseContext.Document, String, String, int, Map)
else adds inputs as aSuggestField
- Overrides:
parse
in classFieldMapper
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Overrides:
toXContent
in classFieldMapper
- Throws:
java.io.IOException
-
parseCreateField
protected void parseCreateField(ParseContext context, java.util.List<org.apache.lucene.index.IndexableField> fields) throws java.io.IOException
Description copied from class:FieldMapper
Parse the field value and populatefields
.- Specified by:
parseCreateField
in classFieldMapper
- Throws:
java.io.IOException
-
contentType
protected java.lang.String contentType()
- Specified by:
contentType
in classFieldMapper
-
doMerge
protected void doMerge(Mapper mergeWith, boolean updateAllTypes)
Description copied from class:FieldMapper
Merge changes coming frommergeWith
in place.- Overrides:
doMerge
in classFieldMapper
updateAllTypes
- TODO
-
-