Package org.elasticsearch.index.mapper
Class MetadataFieldMapper
java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.ParametrizedFieldMapper
org.elasticsearch.index.mapper.MetadataFieldMapper
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<Mapper>
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
- Direct Known Subclasses:
AllFieldMapper
,FieldNamesFieldMapper
,IdFieldMapper
,IgnoredFieldMapper
,IndexFieldMapper
,RoutingFieldMapper
,SeqNoFieldMapper
,SourceFieldMapper
,TypeFieldMapper
,VersionFieldMapper
public abstract class MetadataFieldMapper extends ParametrizedFieldMapper
A mapper for a builtin field containing metadata about a document.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetadataFieldMapper.Builder
static class
MetadataFieldMapper.ConfigurableTypeParser
static class
MetadataFieldMapper.FixedTypeParser
A type parser for an unconfigurable metadata field.static interface
MetadataFieldMapper.TypeParser
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.ParametrizedFieldMapper
ParametrizedFieldMapper.Parameter<T>, ParametrizedFieldMapper.Serializer<T>, ParametrizedFieldMapper.SerializerCheck<T>
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
-
Field Summary
Fields inherited from class org.elasticsearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, fieldType, IGNORE_MALFORMED_SETTING, mappedFieldType, multiFields
-
Constructor Summary
Constructors Modifier Constructor Description protected
MetadataFieldMapper(MappedFieldType mappedFieldType)
-
Method Summary
Modifier and Type Method Description ParametrizedFieldMapper.Builder
getMergeBuilder()
Returns aParametrizedFieldMapper.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 ParametrizedFieldMapper.Parameter<Explicit<java.lang.Boolean>>
updateableBoolParam(java.lang.String name, java.util.function.Function<FieldMapper,Explicit<java.lang.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.ParametrizedFieldMapper
doXContentBody, merge, mergeOptions
Methods inherited from class org.elasticsearch.index.mapper.FieldMapper
clone, contentType, copyTo, createFieldNamesField, docValuesByDefault, doValidate, doXContentAnalyzers, fieldType, indexedByDefault, indexOptionToString, iterator, multiFields, name, parse, parsesArrayValue, storedByDefault, typeName, validate
-
Constructor Details
-
Method Details
-
updateableBoolParam
public static ParametrizedFieldMapper.Parameter<Explicit<java.lang.Boolean>> updateableBoolParam(java.lang.String name, java.util.function.Function<FieldMapper,Explicit<java.lang.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:ParametrizedFieldMapper
Returns aParametrizedFieldMapper.Builder
to be used for merging and serialization Implement as follows:return new MyBuilder(simpleName()).init(this);
- Specified by:
getMergeBuilder
in classParametrizedFieldMapper
-
toXContent
public final 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:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Overrides:
toXContent
in classFieldMapper
- Throws:
java.io.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:
java.io.IOException
-
preParse
Called beforeFieldMapper.parse(ParseContext)
on theRootObjectMapper
.- Throws:
java.io.IOException
-
postParse
Called afterFieldMapper.parse(ParseContext)
on theRootObjectMapper
.- Throws:
java.io.IOException
-