Package org.elasticsearch.index.mapper
Class MetadataFieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.MetadataFieldMapper
- All Implemented Interfaces:
Cloneable,Iterable<Mapper>,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
- Direct Known Subclasses:
AllFieldMapper,DocCountFieldMapper,FieldNamesFieldMapper,IdFieldMapper,IgnoredFieldMapper,IndexFieldMapper,RoutingFieldMapper,SeqNoFieldMapper,SourceFieldMapper,TypeFieldMapper,VersionFieldMapper
A mapper for a builtin field containing metadata about a document.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classA type parser for an unconfigurable metadata field.static interfaceNested classes/interfaces inherited from class org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Conflicts, FieldMapper.CopyTo, FieldMapper.MergeValidator<T>, FieldMapper.MultiFields, FieldMapper.Parameter<T>, FieldMapper.Serializer<T>, FieldMapper.SerializerCheck<T>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 inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, hasScript, IGNORE_MALFORMED_SETTING, indexAnalyzers, mappedFieldType, multiFields, onScriptErrorFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetadataFieldMapper(MappedFieldType mappedFieldType)protectedMetadataFieldMapper(MappedFieldType mappedFieldType, NamedAnalyzer indexAnalyzer) -
Method Summary
Modifier and TypeMethodDescriptionReturns aFieldMapper.Builderto be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);protected voidparseCreateField(ParseContext context)Parse the field value and populate the fields onParseContext.doc().voidpostParse(ParseContext context)Called afterFieldMapper.parse(ParseContext)on theRootObjectMapper.voidpreParse(ParseContext context)Called beforeFieldMapper.parse(ParseContext)on theRootObjectMapper.org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)static FieldMapper.Parameter<Explicit<Boolean>>updateableBoolParam(String name, Function<FieldMapper,Explicit<Boolean>> initializer, boolean defaultValue)Declares an updateable boolean parameter for a metadata field We need to distinguish between explicit configuration and default value for metadata fields, because mapping updates will carry over the previous metadata values if a metadata field is not explicitly declared in the update.Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
checkIncomingMergeType, contentType, copyTo, doValidate, doXContentBody, executeScript, fieldType, hasScript, indexAnalyzers, indexScriptValues, iterator, merge, multiFields, name, notInMultiFields, parse, parsesArrayValue, typeName, validateMethods inherited from class org.elasticsearch.index.mapper.Mapper
simpleNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
MetadataFieldMapper
-
MetadataFieldMapper
-
-
Method Details
-
updateableBoolParam
public static FieldMapper.Parameter<Explicit<Boolean>> updateableBoolParam(String name, Function<FieldMapper,Explicit<Boolean>> initializer, boolean defaultValue)Declares an updateable boolean parameter for a metadata field We need to distinguish between explicit configuration and default value for metadata fields, because mapping updates will carry over the previous metadata values if a metadata field is not explicitly declared in the update. A standard boolean parameter explicitly configured with a default value will not be serialized (as we do not serialize default parameters for mapping updates), and as such will be ignored by the update merge. Instead, we use anExplicitobject that will serialize its value if it has been configured, no matter what the value is. -
getMergeBuilder
Description copied from class:FieldMapperReturns aFieldMapper.Builderto be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);- Specified by:
getMergeBuilderin classFieldMapper
-
toXContent
public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Overrides:
toXContentin classFieldMapper- Throws:
IOException
-
parseCreateField
Description copied from class:FieldMapperParse 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- Specified by:
parseCreateFieldin classFieldMapper- Throws:
IOException
-
preParse
Called beforeFieldMapper.parse(ParseContext)on theRootObjectMapper.- Throws:
IOException
-
postParse
Called afterFieldMapper.parse(ParseContext)on theRootObjectMapper.- Throws:
IOException
-