Class PutMappingRequest

java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.indices.PutMappingRequest
All Implemented Interfaces:
JsonpSerializable

@JsonpDeserializable public class PutMappingRequest extends RequestBase implements JsonpSerializable
Update field mappings.

Add new fields to an existing data stream or index. You can use the update mapping API to:

  • Add a new field to an existing index
  • Update mappings for multiple indices in a single request
  • Add new properties to an object field
  • Enable multi-fields for an existing field
  • Update supported mapping parameters
  • Change a field's mapping using reindexing
  • Rename a field using a field alias

Learn how to use the update mapping API with practical examples in the Update mapping API examples guide.

See Also:
  • Field Details

  • Method Details

    • of

    • fieldNames

      @Nullable public final FieldNamesField fieldNames()
      Control whether field names are enabled for the index.

      API name: _field_names

    • meta

      public final Map<String,JsonData> 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

      @Nullable public final RoutingField routing()
      Enable making a routing value required on indexed documents.

      API name: _routing

    • source

      @Nullable public final SourceField source()
      Control whether the _source field is enabled on the index.

      API name: _source

    • allowNoIndices

      @Nullable public final Boolean allowNoIndices()
      A setting that does two separate checks on the index expression. If false, the request returns an error (1) if any wildcard expression (including _all and *) resolves to zero matching indices or (2) if the complete set of resolved indices, aliases or data streams is empty after all expressions are evaluated. If true, index expressions that resolve to no indices are allowed and the request returns an empty result.

      API name: allow_no_indices

    • dateDetection

      @Nullable public final Boolean dateDetection()
      Controls whether dynamic date detection is enabled.

      API name: date_detection

    • dynamic

      @Nullable public final DynamicMapping dynamic()
      Controls whether new fields are added dynamically.

      API name: dynamic

    • dynamicDateFormats

      public final List<String> 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

      public final List<NamedValue<DynamicTemplate>> dynamicTemplates()
      Specify dynamic templates for the mapping.

      API name: dynamic_templates

    • expandWildcards

      public final List<ExpandWildcard> 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 as open,hidden.

      API name: expand_wildcards

    • ignoreUnavailable

      @Nullable public final Boolean ignoreUnavailable()
      If false, the request returns an error if it targets a concrete (non-wildcarded) index, alias, or data stream that is missing, closed, or otherwise unavailable. If true, unavailable concrete targets are silently ignored.

      API name: ignore_unavailable

    • index

      public final List<String> index()
      Required - A comma-separated list of index names the mapping should be added to (supports wildcards). Use _all or omit to add the mapping on all indices.

      API name: index

    • masterTimeout

      @Nullable public final Time 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

      @Nullable public final Boolean numericDetection()
      Automatically map strings into numeric data types for all fields.

      API name: numeric_detection

    • properties

      public final Map<String,Property> properties()
      Mapping for a field. For new fields, this mapping can include:
      • Field name
      • Field data type
      • Mapping parameters

      API name: properties

    • runtime

      public final Map<String,RuntimeField> runtime()
      Mapping of runtime fields for the index.

      API name: runtime

    • timeout

      @Nullable public final Time 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

      @Nullable public final Boolean writeIndexOnly()
      If true, the mappings are applied only to the current write index for the target.

      API name: write_index_only

    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
    • rebuild

      public PutMappingRequest.Builder rebuild()
      Returns:
      New PutMappingRequest.Builder initialized with field values of this instance
    • setupPutMappingRequestDeserializer

      protected static void setupPutMappingRequestDeserializer(ObjectDeserializer<PutMappingRequest.Builder> op)