Update data stream settings Generally available; Added in 9.1.0

PUT /_data_stream/{name}/_settings

NOTE: Available in 8.19. Not available in earlier versions.

This API can be used to override settings on specific data streams. These overrides will take precedence over what is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state, only certain settings are allowed. If possible, the setting change is applied to all backing indices. Otherwise, it will be applied when the data stream is next rolled over.

Required authorization

  • Index privileges: manage

Path parameters

  • name string | array[string] Required

    A comma-separated list of data streams or data stream patterns.

Query parameters

  • dry_run boolean

    If true, the request does not actually change the settings on any data streams or indices. Instead, it simulates changing the settings and reports back to the user what would have happened had these settings actually been applied.

  • master_timeout string

    The 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.

    Values are -1 or 0.

    External documentation
  • timeout string

    The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

    Values are -1 or 0.

    External documentation
application/json

Body Required

  • index object
  • mode string
  • routing_path string | array[string]

  • soft_deletes object
    Hide soft_deletes attributes Show soft_deletes attributes object
    • enabled boolean

      Indicates whether soft deletes are enabled on the index.

      Default value is true.

    • retention_lease object

      The maximum period to retain a shard history retention lease before it is considered expired. Shard history retention leases ensure that soft deletes are retained during merges on the Lucene index. If a soft delete is merged away before it can be replicated to a follower the following process will fail due to incomplete history on the leader.

      Hide retention_lease attribute Show retention_lease attribute object
      • period string Required

        A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        External documentation
  • sort object
    Hide sort attributes Show sort attributes object
  • number_of_shards number | string Generally available

    One of:

    Default value is 1.

    Default value is 1.

  • number_of_replicas number | string Generally available

    One of:

    Default value is 0.

    Default value is 0.

  • number_of_routing_shards number
  • check_on_startup string

    Values are true, false, or checksum.

  • codec string

    Default value is LZ4.

  • routing_partition_size number | string

  • load_fixed_bitset_filters_eagerly boolean

    Default value is true.

  • hidden boolean | string

    One of:

    Default value is false.

    Default value is false.

  • auto_expand_replicas string | null

    One of:

    Default value is false.

    A null value that is to be interpreted as an actual value, unless other uses of null that are equivalent to a missing value. It is used for exemple in settings, where using the NullValue for a setting will reset it to its default value.

  • merge object
    Hide merge attribute Show merge attribute object
  • refresh_interval string

    A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

    External documentation
  • max_result_window number

    Default value is 10000.0.

  • max_inner_result_window number

    Default value is 100.0.

  • max_rescore_window number

    Default value is 10000.0.

  • max_script_fields number

    Default value is 32.0.

  • max_ngram_diff number

    Default value is 1.0.

  • max_shingle_diff number

    Default value is 3.0.

  • blocks object
    Hide blocks attributes Show blocks attributes object
  • max_refresh_listeners number
  • analyze object

    Settings to define analyzers, tokenizers, token filters and character filters. Refer to the linked documentation for step-by-step examples of updating analyzers on existing indices.

    External documentation
    Hide analyze attribute Show analyze attribute object
  • highlight object
    Hide highlight attribute Show highlight attribute object
    • max_analyzed_offset number

      Default value is 1000000.0.

  • max_terms_count number

    Default value is 65536.0.

  • max_regex_length number

    Default value is 1000.0.

  • routing object
    Hide routing attributes Show routing attributes object
    • allocation object
      Hide allocation attributes Show allocation attributes object
      • enable string

        Values are all, primaries, new_primaries, or none.

      • include object
        Hide include attribute Show include attribute object
        • _tier_preference string
      • initial_recovery object
      • disk object
        Hide disk attribute Show disk attribute object
        • threshold_enabled
    • rebalance object
      Hide rebalance attribute Show rebalance attribute object
      • enable string Required

        Values are all, primaries, replicas, or none.

  • gc_deletes string

    A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

    External documentation
  • default_pipeline string
  • final_pipeline string
  • lifecycle object
    Hide lifecycle attributes Show lifecycle attributes object
    • name string

      The name of the policy to use to manage the index. For information about how Elasticsearch applies policy changes, see Policy updates.

    • indexing_complete boolean | string

      Indicates whether or not the index has been rolled over. Automatically set to true when ILM completes the rollover action. You can explicitly set it to skip rollover.

    • origination_date number

      If specified, this is the timestamp used to calculate the index age for its phase transitions. Use this setting if you create a new index that contains old data and want to use the original creation date to calculate the index age. Specified as a Unix epoch value in milliseconds.

      Default value is 0.0.

    • parse_origination_date boolean

      Set to true to parse the origination date from the index name. This origination date is used to calculate the index age for its phase transitions. The index name must match the pattern .*-{date_format}-\d+, where the date_format is yyyy.MM.dd and the trailing digits are optional. An index that was rolled over would normally match the full format, for example logs-2016.10.31-000002). If the index name doesn’t match the pattern, index creation fails.

    • step object
      Hide step attribute Show step attribute object
      • wait_time_threshold string

        Time to wait for the cluster to resolve allocation issues during an ILM shrink action. Must be greater than 1h (1 hour). See Shard allocation for shrink.

        External documentation
    • rollover_alias string

      The index alias to update when the index rolls over. Specify when using a policy that contains a rollover action. When the index rolls over, the alias is updated to reflect that the index is no longer the write index. For more information about rolling indices, see Rollover.

      Default value is empty.

    • prefer_ilm boolean | string

      Preference for the system that manages a data stream backing index (preferring ILM when both ILM and DLM are applicable for an index).

      One of:

      Default value is true.

      Default value is true.

  • provided_name string
  • creation_date number | string

    One of:

    Time unit for milliseconds

  • creation_date_string string | number

    One of:

    Time unit for milliseconds

  • uuid string
  • version object
    Hide version attributes Show version attributes object
    • created string
    • created_string string
  • verified_before_close boolean | string

  • format string | number

  • max_slices_per_scroll number
  • translog object
    Hide translog attributes Show translog attributes object
    • sync_interval string

      How often the translog is fsynced to disk and committed, regardless of write operations. Values less than 100ms are not allowed.

      External documentation
    • durability string

      Whether or not to fsync and commit the translog after every index, delete, update, or bulk request.

      Values are request, REQUEST, async, or ASYNC.

    • flush_threshold_size number | string

      The translog stores all operations that are not yet safely persisted in Lucene (i.e., are not part of a Lucene commit point). Although these operations are available for reads, they will need to be replayed if the shard was stopped and had to be recovered. This setting controls the maximum total size of these operations, to prevent recoveries from taking too long. Once the maximum size has been reached a flush will happen, generating a new Lucene commit point.

    • retention object
      Hide retention attributes Show retention attributes object
      • size number | string

        This controls the total size of translog files to keep for each shard. Keeping more translog files increases the chance of performing an operation based sync when recovering a replica. If the translog files are not sufficient, replica recovery will fall back to a file based sync. This setting is ignored, and should not be set, if soft deletes are enabled. Soft deletes are enabled by default in indices created in Elasticsearch versions 7.0.0 and later.

      • age string

        This controls the maximum duration for which translog files are kept by each shard. Keeping more translog files increases the chance of performing an operation based sync when recovering replicas. If the translog files are not sufficient, replica recovery will fall back to a file based sync. This setting is ignored, and should not be set, if soft deletes are enabled. Soft deletes are enabled by default in indices created in Elasticsearch versions 7.0.0 and later.

        External documentation
  • query_string object
    Hide query_string attribute Show query_string attribute object
  • priority number | string

  • top_metrics_max_size number
  • analysis object
    Hide analysis attributes Show analysis attributes object
    • analyzer object
    • char_filter object
    • filter object
    • normalizer object
    • tokenizer object
  • settings object
  • time_series object
    Hide time_series attributes Show time_series attributes object
  • queries object
    Hide queries attribute Show queries attribute object
    • cache object
      Hide cache attribute Show cache attribute object
      • enabled boolean Required
  • similarity object

    Configure custom similarity settings to customize how search results are scored.

  • mapping object

    Enable or disable dynamic mapping for an index.

    Hide mapping attributes Show mapping attributes object
    • coerce boolean
    • total_fields object
      Hide total_fields attributes Show total_fields attributes object
      • limit number | string

        The maximum number of fields in an index. Field and object mappings, as well as field aliases count towards this limit. The limit is in place to prevent mappings and searches from becoming too large. Higher values can lead to performance degradations and memory issues, especially in clusters with a high load or few resources.

        One of:

        Default value is 1000.

        Default value is 1000.

      • ignore_dynamic_beyond_limit boolean | string

        This setting determines what happens when a dynamically mapped field would exceed the total fields limit. When set to false (the default), the index request of the document that tries to add a dynamic field to the mapping will fail with the message Limit of total fields [X] has been exceeded. When set to true, the index request will not fail. Instead, fields that would exceed the limit are not added to the mapping, similar to dynamic: false. The fields that were not added to the mapping will be added to the _ignored field.

        One of:

        Default value is false.

        Default value is false.

    • depth object
      Hide depth attribute Show depth attribute object
      • limit number

        The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc.

        Default value is 20.0.

    • nested_fields object
      Hide nested_fields attribute Show nested_fields attribute object
      • limit number

        The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when arrays of objects need to be queried independently of each other. To safeguard against poorly designed mappings, this setting limits the number of unique nested types per index.

        Default value is 50.0.

    • nested_objects object
      Hide nested_objects attribute Show nested_objects attribute object
      • limit number

        The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects.

        Default value is 10000.0.

    • field_name_length object
      Hide field_name_length attribute Show field_name_length attribute object
      • limit number

        Setting for the maximum length of a field name. This setting isn’t really something that addresses mappings explosion but might still be useful if you want to limit the field length. It usually shouldn’t be necessary to set this setting. The default is okay unless a user starts to add a huge number of fields with really long names. Default is Long.MAX_VALUE (no limit).

    • dimension_fields object
      Hide dimension_fields attribute Show dimension_fields attribute object
      • limit number

        [preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

    • source object
      Hide source attribute Show source attribute object
      • mode string Required

        Values are disabled, stored, or synthetic.

    • ignore_malformed boolean | string

  • indexing.slowlog object
    Hide indexing.slowlog attributes Show indexing.slowlog attributes object
    • level string
    • source number
    • reformat boolean
    • threshold object
      Hide threshold attribute Show threshold attribute object
      • index object

        The indexing slow log, similar in functionality to the search slow log. The log file name ends with _index_indexing_slowlog.json. Log and the thresholds are configured in the same way as the search slowlog.

  • indexing_pressure object

    Configure indexing back pressure limits.

    Hide indexing_pressure attribute Show indexing_pressure attribute object
    • memory object Required
      Hide memory attribute Show memory attribute object
      • limit number

        Number of outstanding bytes that may be consumed by indexing requests. When this limit is reached or exceeded, the node will reject new coordinating and primary operations. When replica operations consume 1.5x this limit, the node will reject new replica operations. Defaults to 10% of the heap.

  • store object

    The store module allows you to control how index data is stored and accessed on disk.

    Hide store attributes Show store attributes object
    • type string

      Any of:

      Values are fs, niofs, mmapfs, or hybridfs.

    • allow_mmap boolean

      You can restrict the use of the mmapfs and the related hybridfs store type via the setting node.store.allow_mmap. This is a boolean setting indicating whether or not memory-mapping is allowed. The default is to allow it. This setting is useful, for example, if you are in an environment where you can not control the ability to create a lot of memory maps so you need disable the ability to use memory-mapping.

    • stats_refresh_interval string

      How often store statistics are refreshed

      External documentation

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • data_streams array[object] Required
      Hide data_streams attributes Show data_streams attributes object
      • name string Required

        The data stream name.

      • applied_to_data_stream boolean Required

        If the settings were successfully applied to the data stream (or would have been, if running in dry_run mode), it is true. If an error occurred, it is false.

      • error string

        A message explaining why the settings could not be applied to the data stream.

      • settings object Required

        The settings that are specfic to this data stream that will override any settings from the matching index template.

        Hide settings attributes Show settings attributes object
        • index object
        • mode string
        • routing_path string | array[string]

        • soft_deletes object
        • sort object
        • number_of_shards number | string Generally available

          One of:

          Default value is 1.

          Default value is 1.

        • number_of_replicas number | string Generally available

          One of:

          Default value is 0.

          Default value is 0.

        • number_of_routing_shards number
        • check_on_startup string

          Values are true, false, or checksum.

        • codec string

          Default value is LZ4.

        • routing_partition_size
        • load_fixed_bitset_filters_eagerly boolean

          Default value is true.

        • hidden boolean | string

          One of:

          Default value is false.

          Default value is false.

        • auto_expand_replicas string | null

          One of:

          Default value is false.

          A null value that is to be interpreted as an actual value, unless other uses of null that are equivalent to a missing value. It is used for exemple in settings, where using the NullValue for a setting will reset it to its default value.

        • merge object
        • refresh_interval string

          A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • max_result_window number

          Default value is 10000.0.

        • max_inner_result_window number

          Default value is 100.0.

        • max_rescore_window number

          Default value is 10000.0.

        • max_script_fields number

          Default value is 32.0.

        • max_ngram_diff number

          Default value is 1.0.

        • max_shingle_diff number

          Default value is 3.0.

        • blocks object
        • max_refresh_listeners number
        • analyze object

          Settings to define analyzers, tokenizers, token filters and character filters. Refer to the linked documentation for step-by-step examples of updating analyzers on existing indices.

        • highlight object
        • max_terms_count number

          Default value is 65536.0.

        • max_regex_length number

          Default value is 1000.0.

        • routing object
        • gc_deletes string

          A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • default_pipeline string
        • final_pipeline string
        • lifecycle object
        • provided_name string
        • creation_date
        • creation_date_string
        • uuid string
        • version object
        • verified_before_close boolean | string

        • format string | number

        • max_slices_per_scroll number
        • translog object
        • query_string object
        • priority number | string

        • top_metrics_max_size number
        • analysis object
        • settings object
        • time_series object
        • queries object
        • similarity object

          Configure custom similarity settings to customize how search results are scored.

        • mapping object

          Enable or disable dynamic mapping for an index.

        • indexing.slowlog object
        • indexing_pressure object

          Configure indexing back pressure limits.

        • store object

          The store module allows you to control how index data is stored and accessed on disk.

      • effective_settings object Required

        The settings that are effective on this data stream, taking into account the settings from the matching index template and the settings specific to this data stream.

        Hide effective_settings attributes Show effective_settings attributes object
        • index object
        • mode string
        • routing_path string | array[string]

        • soft_deletes object
        • sort object
        • number_of_shards number | string Generally available

          One of:

          Default value is 1.

          Default value is 1.

        • number_of_replicas number | string Generally available

          One of:

          Default value is 0.

          Default value is 0.

        • number_of_routing_shards number
        • check_on_startup string

          Values are true, false, or checksum.

        • codec string

          Default value is LZ4.

        • routing_partition_size
        • load_fixed_bitset_filters_eagerly boolean

          Default value is true.

        • hidden boolean | string

          One of:

          Default value is false.

          Default value is false.

        • auto_expand_replicas string | null

          One of:

          Default value is false.

          A null value that is to be interpreted as an actual value, unless other uses of null that are equivalent to a missing value. It is used for exemple in settings, where using the NullValue for a setting will reset it to its default value.

        • merge object
        • refresh_interval string

          A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • max_result_window number

          Default value is 10000.0.

        • max_inner_result_window number

          Default value is 100.0.

        • max_rescore_window number

          Default value is 10000.0.

        • max_script_fields number

          Default value is 32.0.

        • max_ngram_diff number

          Default value is 1.0.

        • max_shingle_diff number

          Default value is 3.0.

        • blocks object
        • max_refresh_listeners number
        • analyze object

          Settings to define analyzers, tokenizers, token filters and character filters. Refer to the linked documentation for step-by-step examples of updating analyzers on existing indices.

        • highlight object
        • max_terms_count number

          Default value is 65536.0.

        • max_regex_length number

          Default value is 1000.0.

        • routing object
        • gc_deletes string

          A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • default_pipeline string
        • final_pipeline string
        • lifecycle object
        • provided_name string
        • creation_date
        • creation_date_string
        • uuid string
        • version object
        • verified_before_close boolean | string

        • format string | number

        • max_slices_per_scroll number
        • translog object
        • query_string object
        • priority number | string

        • top_metrics_max_size number
        • analysis object
        • settings object
        • time_series object
        • queries object
        • similarity object

          Configure custom similarity settings to customize how search results are scored.

        • mapping object

          Enable or disable dynamic mapping for an index.

        • indexing.slowlog object
        • indexing_pressure object

          Configure indexing back pressure limits.

        • store object

          The store module allows you to control how index data is stored and accessed on disk.

      • index_settings_results object Required

        Information about whether and where each setting was applied.

        Hide index_settings_results attributes Show index_settings_results attributes object
        • applied_to_data_stream_only array[string] Required

          The list of settings that were applied to the data stream but not to backing indices. These will be applied to the write index the next time the data stream is rolled over.

        • applied_to_data_stream_and_backing_indices array[string] Required

          The list of settings that were applied to the data stream and to all of its backing indices. These settings will also be applied to the write index the next time the data stream is rolled over.

        • errors array[object]
PUT /_data_stream/{name}/_settings
curl \
 --request PUT 'http://api.example.com/_data_stream/{name}/_settings' \
 --header "Content-Type: application/json" \
 --data '"{\n  \"index.lifecycle.name\" : \"new-test-policy\",\n  \"index.number_of_shards\": 11\n}"'
Request example
This is a request to change two settings on a data stream.
{
  "index.lifecycle.name" : "new-test-policy",
  "index.number_of_shards": 11
}
Response examples (200)
This shows a response to `PUT /_data_stream/my-data-stream/_settings` when two settings are successfully updated on the data stream. In this case, `index.number_of_shards` is only applied to the data stream -- it will be applied to the write index on rollover. The setting `index.lifecycle.name` is applied to the data stream and all backing indices.
{
  "data_streams": [
    {
      "name": "my-data-stream",
      "applied_to_data_stream": true,
      "settings": {
        "index": {
          "lifecycle": {
            "name": "new-test-policy"
          },
          "number_of_shards": "11"
        }
      },
      "effective_settings": {
        "index": {
          "lifecycle": {
            "name": "new-test-policy"
          },
          "mode": "standard",
          "number_of_shards": "11",
          "number_of_replicas": "0"
        }
      },
      "index_settings_results": {
        "applied_to_data_stream_only": [
          "index.number_of_shards"
        ],
        "applied_to_data_stream_and_backing_indices": [
          "index.lifecycle.name"
        ]
      }
    }
  ]
}
This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a setting is successfully applied to the data stream, but one of the backing indices, `.ds-my-data-stream-2025.05.28-000001`, has a write block. The response reports that the setting was not successfully applied to that index.
{
  "data_streams": [
    {
      "name": "my-data-stream",
      "applied_to_data_stream": true,
      "settings": {
        "index": {
          "lifecycle": {
            "name": "new-test-policy"
          },
          "number_of_shards": "11"
        }
      },
      "effective_settings": {
        "index": {
          "lifecycle": {
            "name": "new-test-policy"
          },
          "mode": "standard",
          "number_of_shards": "11",
          "number_of_replicas": "0"
        }
      },
      "index_settings_results": {
        "applied_to_data_stream_only": [
          "index.number_of_shards"
        ],
        "applied_to_data_stream_and_backing_indices": [
          "index.lifecycle.name"
        ],
        "errors": [
          {
            "index": ".ds-my-data-stream-2025.05.28-000001",
            "error": "index [.ds-my-data-stream-2025.05.28-000001] blocked by: [FORBIDDEN/9/index metadata (api)];"
          }
        ]
      }
    }
  ]
}
This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a user attempts to set a setting that is not allowed on a data stream. As a result, no change was applied to the data stream.
{
  "data_streams": [
    {
      "name": "my-data-stream",
      "applied_to_data_stream": false,
      "error": "Cannot set the following settings on a data stream: [index.number_of_replicas]",
      "settings": {},
      "effective_settings": {},
      "index_settings_results": {
        "applied_to_data_stream_only": [],
        "applied_to_data_stream_and_backing_indices": []
      }
    }
  ]
}