Class MetadataFieldMapper
- All Implemented Interfaces:
Cloneable
,Iterable<Mapper>
,org.opensearch.core.xcontent.ToXContent
,org.opensearch.core.xcontent.ToXContentFragment
- Direct Known Subclasses:
DataStreamFieldMapper
,DocCountFieldMapper
,FieldNamesFieldMapper
,IdFieldMapper
,IgnoredFieldMapper
,IndexFieldMapper
,NestedPathFieldMapper
,RoutingFieldMapper
,SeqNoFieldMapper
,SourceFieldMapper
,VersionFieldMapper
- Opensearch.api:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Base builder for internal metadata fieldsstatic class
Type parser that is configurablestatic class
A type parser for an unconfigurable metadata field.static interface
Type parser for the field mapperNested classes/interfaces inherited from class org.opensearch.index.mapper.ParametrizedFieldMapper
ParametrizedFieldMapper.Parameter<T>, ParametrizedFieldMapper.Serializer<T>, ParametrizedFieldMapper.SerializerCheck<T>
Nested classes/interfaces inherited from class org.opensearch.index.mapper.FieldMapper
FieldMapper.CopyTo, FieldMapper.MultiFields
Nested classes/interfaces inherited from class org.opensearch.index.mapper.Mapper
Mapper.BuilderContext
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params
-
Field Summary
Fields inherited from class org.opensearch.index.mapper.FieldMapper
COERCE_SETTING, copyTo, fieldType, IGNORE_MALFORMED_SETTING, mappedFieldType, multiFields
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns aParametrizedFieldMapper.Builder
to be used for merging and serializationprotected 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
.final org.opensearch.core.xcontent.XContentBuilder
toXContent
(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) static ParametrizedFieldMapper.Parameter
<org.opensearch.common.Explicit<Boolean>> updateableBoolParam
(String name, Function<FieldMapper, org.opensearch.common.Explicit<Boolean>> initializer, boolean defaultValue) Declares an updateable boolean parameter for a metadata fieldMethods inherited from class org.opensearch.index.mapper.ParametrizedFieldMapper
doXContentBody, merge, mergeOptions
Methods inherited from class org.opensearch.index.mapper.FieldMapper
clone, contentType, copyTo, createFieldNamesField, docValuesByDefault, doValidate, doXContentAnalyzers, fieldType, indexedByDefault, indexOptionToString, iterator, multiFields, name, parse, parsesArrayValue, storedByDefault, typeName, validate
Methods inherited from class org.opensearch.index.mapper.Mapper
hasIndexCreated, simpleName
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.opensearch.core.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
MetadataFieldMapper
-
-
Method Details
-
updateableBoolParam
public static ParametrizedFieldMapper.Parameter<org.opensearch.common.Explicit<Boolean>> updateableBoolParam(String name, Function<FieldMapper, org.opensearch.common.Explicit<Boolean>> initializer, boolean defaultValue) Declares an updateable boolean parameter for a metadata fieldWe 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 an
Explicit
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 serializationImplement as follows:
return new MyBuilder(simpleName()).init(this);
- Specified by:
getMergeBuilder
in classParametrizedFieldMapper
-
toXContent
public final org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceorg.opensearch.core.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
-