Package org.elasticsearch.index.mapper
Class FieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<Mapper>,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
- Direct Known Subclasses:
AbstractGeometryFieldMapper,BinaryFieldMapper,BooleanFieldMapper,CompletionFieldMapper,DateFieldMapper,DynamicKeyFieldMapper,IpFieldMapper,KeywordFieldMapper,MetadataFieldMapper,NumberFieldMapper,RangeFieldMapper,TextFieldMapper
public abstract class FieldMapper extends Mapper implements java.lang.Cloneable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFieldMapper.BuilderA Builder for a ParametrizedFieldMapperstatic classFieldMapper.Conflictsstatic classFieldMapper.CopyToRepresents a list of fields with optional boost factor where the current field should be copied toprotected static interfaceFieldMapper.MergeValidator<T>static classFieldMapper.MultiFieldsstatic classFieldMapper.Parameter<T>A configurable parameter for a field mapperstatic interfaceFieldMapper.Serializer<T>Serializes a parameterstatic interfaceFieldMapper.SerializerCheck<T>Check on whether or not a parameter should be serializedstatic classFieldMapper.TypeParserTypeParser implementation that automatically handles parsing -
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Boolean>COERCE_SETTINGprotected FieldMapper.CopyTocopyTostatic Setting<java.lang.Boolean>IGNORE_MALFORMED_SETTINGprotected java.util.Map<java.lang.String,NamedAnalyzer>indexAnalyzersprotected MappedFieldTypemappedFieldTypeprotected FieldMapper.MultiFieldsmultiFields -
Constructor Summary
Constructors Modifier Constructor Description protectedFieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, java.util.Map<java.lang.String,NamedAnalyzer> indexAnalyzers, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper that indexes into multiple analyzed fieldsprotectedFieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, NamedAnalyzer indexAnalyzer, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper with a single associated index analyzerprotectedFieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper with no index analyzers -
Method Summary
Modifier and Type Method Description protected voidcheckIncomingMergeType(FieldMapper mergeWith)protected abstract java.lang.StringcontentType()FieldMapper.CopyTocopyTo()List of fields where this field should be copied toprotected voidcreateFieldNamesField(ParseContext context)protected voiddoValidate(MappingLookup mappers)protected voiddoXContentBody(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults, org.elasticsearch.common.xcontent.ToXContent.Params params)MappedFieldTypefieldType()abstract FieldMapper.BuildergetMergeBuilder()Returns aFieldMapper.Builderto be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);java.util.Map<java.lang.String,NamedAnalyzer>indexAnalyzers()java.util.Iterator<Mapper>iterator()FieldMappermerge(Mapper mergeWith)Return the merge ofmergeWithinto this.FieldMapper.MultiFieldsmultiFields()java.lang.Stringname()Returns the canonical name which uniquely identifies the mapper against other mappers in a type.voidparse(ParseContext context)Parse the field value using the providedParseContext.protected abstract voidparseCreateField(ParseContext context)Parse the field value and populate the fields onParseContext.doc().booleanparsesArrayValue()Whether this mapper can handle an array value during document parsing.org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)java.lang.StringtypeName()Returns a name representing the type of this mapper.voidvalidate(MappingLookup mappers)Validate any cross-field references made by this mapper
-
Field Details
-
Constructor Details
-
FieldMapper
protected FieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper with no index analyzers- Parameters:
simpleName- the leaf name of the mappermappedFieldType- the MappedFieldType associated with this mappermultiFields- sub fields of this mappercopyTo- copyTo fields of this mapper
-
FieldMapper
protected FieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, NamedAnalyzer indexAnalyzer, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper with a single associated index analyzer- Parameters:
simpleName- the leaf name of the mappermappedFieldType- the MappedFieldType associated with this mapperindexAnalyzer- the index-time analyzer to use for this fieldmultiFields- sub fields of this mappercopyTo- copyTo fields of this mapper
-
FieldMapper
protected FieldMapper(java.lang.String simpleName, MappedFieldType mappedFieldType, java.util.Map<java.lang.String,NamedAnalyzer> indexAnalyzers, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)Create a FieldMapper that indexes into multiple analyzed fields- Parameters:
simpleName- the leaf name of the mappermappedFieldType- the MappedFieldType associated with this mapperindexAnalyzers- a map of field names to analyzers, one for each analyzed field the mapper will addmultiFields- sub fields of this mappercopyTo- copyTo fields of this mapper
-
-
Method Details
-
name
public java.lang.String name()Description copied from class:MapperReturns the canonical name which uniquely identifies the mapper against other mappers in a type. -
typeName
public java.lang.String typeName()Description copied from class:MapperReturns a name representing the type of this mapper. -
fieldType
-
copyTo
List of fields where this field should be copied to -
multiFields
-
parsesArrayValue
public boolean parsesArrayValue()Whether this mapper can handle an array value during document parsing. If true, when an array is encountered during parsing, the document parser will pass the whole array to the mapper. If false, the array is split into individual values and each value is passed to the mapper for parsing. -
parse
Parse the field value using the providedParseContext.- Throws:
java.io.IOException
-
parseCreateField
Parse the field value and populate the fields onParseContext.doc(). Implementations of this method should ensure that on failing to parse parser.currentToken() must be the current failing token- Throws:
java.io.IOException
-
createFieldNamesField
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<Mapper>
-
validate
Description copied from class:MapperValidate any cross-field references made by this mapper- Specified by:
validatein classMapper- Parameters:
mappers- aMappingLookupthat can produce references to other mappers
-
doValidate
-
getMergeBuilder
Returns aFieldMapper.Builderto be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this); -
merge
Description copied from class:MapperReturn the merge ofmergeWithinto this. BoththisandmergeWithwill be left unmodified. -
checkIncomingMergeType
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
doXContentBody
protected void doXContentBody(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-
contentType
protected abstract java.lang.String contentType() -
indexAnalyzers
-