Class PutMappingRequest
- All Implemented Interfaces:
JsonpSerializable
Add multi-fields to an existing field
Multi-fields let you index the same field in different ways. You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. You can populate the new multi-field with the update by query API.
Change supported mapping parameters for an existing field
The documentation for each mapping parameter indicates whether you can update
it for an existing field using this API. For example, you can use the update
mapping API to update the ignore_above parameter.
Change the mapping of an existing field
Except for supported mapping parameters, you can't change the mapping or field type of an existing field. Changing an existing field could invalidate data that's already indexed.
If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.
Rename a field
Renaming a field would invalidate data already indexed under the old field name. Instead, add an alias field to create an alternate field name.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<PutMappingRequest>Json deserializer forPutMappingRequeststatic final Endpoint<PutMappingRequest,PutMappingResponse, ErrorResponse> Endpoint "indices.put_mapping". -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanIffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices.final BooleanControls whether dynamic date detection is enabled.final DynamicMappingdynamic()Controls whether new fields are added dynamically.If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string.final List<NamedValue<DynamicTemplate>>Specify dynamic templates for the mapping.final List<ExpandWildcard>Type of index that wildcard patterns can match.final FieldNamesFieldControl whether field names are enabled for the index.final BooleanIffalse, the request returns an error if it targets a missing or closed index.index()Required - A comma-separated list of index names the mapping should be added to (supports wildcards); use_allor omit to add the mapping on all indices.final TimePeriod to wait for a connection to the master node.meta()A mapping type can have custom meta data associated with it.final BooleanAutomatically map strings into numeric data types for all fields.static PutMappingRequestMapping for a field.final RoutingFieldrouting()Enable making a routing value required on indexed documents.final Map<String,RuntimeField> runtime()Mapping of runtime fields for the index.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static voidfinal SourceFieldsource()Control whether the _source field is enabled on the index.final Timetimeout()Period to wait for a response.final BooleanIftrue, the mappings are applied only to the current write index for the target.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forPutMappingRequest -
_ENDPOINT
Endpoint "indices.put_mapping".
-
-
Method Details
-
of
public static PutMappingRequest of(Function<PutMappingRequest.Builder, ObjectBuilder<PutMappingRequest>> fn) -
fieldNames
Control whether field names are enabled for the index.API name:
_field_names -
meta
A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata.API name:
_meta -
routing
Enable making a routing value required on indexed documents.API name:
_routing -
source
Control whether the _source field is enabled on the index.API name:
_source -
allowNoIndices
Iffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices.API name:
allow_no_indices -
dateDetection
Controls whether dynamic date detection is enabled.API name:
date_detection -
dynamic
Controls whether new fields are added dynamically.API name:
dynamic -
dynamicDateFormats
If date detection is enabled then new string fields are checked against 'dynamic_date_formats' and if the value matches then a new date field is added instead of string.API name:
dynamic_date_formats -
dynamicTemplates
Specify dynamic templates for the mapping.API name:
dynamic_templates -
expandWildcards
Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such asopen,hidden.API name:
expand_wildcards -
index
Required - A comma-separated list of index names the mapping should be added to (supports wildcards); use_allor omit to add the mapping on all indices.API name:
index -
masterTimeout
Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.API name:
master_timeout -
numericDetection
Automatically map strings into numeric data types for all fields.API name:
numeric_detection -
properties
Mapping for a field. For new fields, this mapping can include:- Field name
- Field data type
- Mapping parameters
API name:
properties -
runtime
Mapping of runtime fields for the index.API name:
runtime -
timeout
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.API name:
timeout -
writeIndexOnly
Iftrue, the mappings are applied only to the current write index for the target.API name:
write_index_only -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
setupPutMappingRequestDeserializer
protected static void setupPutMappingRequestDeserializer(ObjectDeserializer<PutMappingRequest.Builder> op)
-