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>
,ToXContent
,ToXContentFragment
- Direct Known Subclasses:
AllFieldMapper
,DataStreamTimestampFieldMapper
,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.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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.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
(DocumentParserContext context) Parse the field value and populate the fields onDocumentParserContext.doc()
.void
postParse
(DocumentParserContext context) Called afterFieldMapper.parse(DocumentParserContext)
on theRootObjectMapper
.void
preParse
(DocumentParserContext context) Called beforeFieldMapper.parse(DocumentParserContext)
on theRootObjectMapper
.final XContentBuilder
toXContent
(XContentBuilder builder, 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.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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Overrides:
toXContent
in classFieldMapper
- Throws:
IOException
-
parseCreateField
Description copied from class:FieldMapper
Parse the field value and populate the fields onDocumentParserContext.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(DocumentParserContext)
on theRootObjectMapper
.- Throws:
IOException
-
postParse
Called afterFieldMapper.parse(DocumentParserContext)
on theRootObjectMapper
.- Throws:
IOException
-