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
Modifier and TypeClassDescriptionstatic class
static class
static class
A type parser for an unconfigurable metadata field.static interface
Nested 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, onScriptError
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
MetadataFieldMapper(MappedFieldType mappedFieldType)
protected
MetadataFieldMapper(MappedFieldType mappedFieldType, NamedAnalyzer indexAnalyzer)
-
Method Summary
Modifier and TypeMethodDescriptionReturns aFieldMapper.Builder
to be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);
protected void
parseCreateField(ParseContext context)
Parse the field value and populate the fields onParseContext.doc()
.void
postParse(ParseContext context)
Called afterFieldMapper.parse(ParseContext)
on theRootObjectMapper
.void
preParse(ParseContext context)
Called beforeFieldMapper.parse(ParseContext)
on theRootObjectMapper
.org.elasticsearch.common.xcontent.XContentBuilder
toXContent(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, 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.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 anExplicit
object that will serialize its value if it has been configured, no matter what the value is. -
getMergeBuilder
Description copied from class:FieldMapper
Returns aFieldMapper.Builder
to be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);
- Specified by:
getMergeBuilder
in 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:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Overrides:
toXContent
in classFieldMapper
- Throws:
IOException
-
parseCreateField
Description copied from class:FieldMapper
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- Specified by:
parseCreateField
in classFieldMapper
- Throws:
IOException
-
preParse
Called beforeFieldMapper.parse(ParseContext)
on theRootObjectMapper
.- Throws:
IOException
-
postParse
Called afterFieldMapper.parse(ParseContext)
on theRootObjectMapper
.- Throws:
IOException
-