java.lang.Object
org.elasticsearch.index.mapper.Mapper.Builder
org.elasticsearch.index.mapper.FieldMapper.Builder
- All Implemented Interfaces:
ToXContent,ToXContentFragment
- Direct Known Subclasses:
BinaryFieldMapper.Builder,CompletionFieldMapper.Builder,DateFieldMapper.Builder,DenseVectorFieldMapper.Builder,FieldMapper.DimensionBuilder,FieldMapper.TextFamilyBuilder,FlattenedFieldMapper.Builder,GeoPointFieldMapper.Builder,MetadataFieldMapper.Builder,PlaceHolderFieldMapper.Builder,RangeFieldMapper.Builder,SparseVectorFieldMapper.Builder
- Enclosing class:
FieldMapper
public abstract static class FieldMapper.Builder
extends Mapper.Builder
implements ToXContentFragment
A Builder for a ParametrizedFieldMapper
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FieldMapper.CopyToprotected booleanprotected final FieldMapper.MultiFields.Builderprotected OnScriptErrorprotected Optional<Mapper.SourceKeepMode> Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMultiField(FieldMapper.Builder builder) protected voidaddScriptValidation(FieldMapper.Parameter<Script> scriptParam, FieldMapper.Parameter<Boolean> indexParam, Supplier<Boolean> docValuesParam) abstract FieldMapperbuild(MapperBuilderContext context) Returns a newly built mapper.protected FieldMapper.BuilderParamsbuilderParams(Mapper.Builder mainFieldBuilder, MapperBuilderContext context) abstract Stringprotected abstract FieldMapper.Parameter<?>[]protected voidhandleUnknownParamOnLegacyIndex(String propName, Object propNode) init(FieldMapper initializer) Initialises all parameters from an existing mapperprotected voidmergeFromBuilder(FieldMapper.Builder incoming, FieldMapper.Conflicts conflicts, MapperMergeContext mergeContext) mergeWith(Mapper.Builder incoming, MapperMergeContext mergeContext) Merges an incoming builder into this builder.final voidParse mapping parameters from a map of mappingsprotected voidthrowMergeTypeConflict(FieldMapper.Builder incoming, String fullName) Throws an error when the incoming builder has a different class or content type.toXContent(XContentBuilder builder, ToXContent.Params params) Writes the current builder parameter values as XContentprotected final voidvalidate()Methods inherited from class org.elasticsearch.index.mapper.Mapper.Builder
leafNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
multiFieldsBuilder
-
copyTo
-
sourceKeepMode
-
hasScript
protected boolean hasScript -
onScriptError
-
-
Constructor Details
-
Builder
Creates a new Builder with a field name
-
-
Method Details
-
init
Initialises all parameters from an existing mapper -
addMultiField
-
builderParams
protected FieldMapper.BuilderParams builderParams(Mapper.Builder mainFieldBuilder, MapperBuilderContext context) -
validate
protected final void validate() -
getParameters
- Returns:
- the list of parameters defined for this mapper
-
contentType
- Returns:
- the content type name for this field mapper builder, matching the value
returned by
FieldMapper.contentType()on the built mapper
-
mergeWith
Description copied from class:Mapper.BuilderMerges an incoming builder into this builder. Returns the merged builder, which may be a different instance if a type conversion is needed (e.g., ObjectMapper -> PassThroughObjectMapper).- Specified by:
mergeWithin classMapper.Builder
-
throwMergeTypeConflict
Throws an error when the incoming builder has a different class or content type. Subclasses can override to provide more specific error messages. -
mergeFromBuilder
protected void mergeFromBuilder(FieldMapper.Builder incoming, FieldMapper.Conflicts conflicts, MapperMergeContext mergeContext) -
build
Description copied from class:Mapper.BuilderReturns a newly built mapper.- Specified by:
buildin classMapper.Builder
-
addScriptValidation
protected void addScriptValidation(FieldMapper.Parameter<Script> scriptParam, FieldMapper.Parameter<Boolean> indexParam, Supplier<Boolean> docValuesParam) -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException Writes the current builder parameter values as XContent- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
parse
public final void parse(String name, MappingParserContext parserContext, Map<String, Object> fieldNode) Parse mapping parameters from a map of mappings- Parameters:
name- the field mapper nameparserContext- the parser contextfieldNode- the root node of the map of mappings for this field
-
handleUnknownParamOnLegacyIndex
-