Create an index from a source index Generally available; Added in 8.18.0

PUT /_create_from/{source}/{dest}

Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.

Creating an index from source

Path parameters

  • source string Required

    The source index or data stream name

  • dest string Required

    The destination index or data stream name

application/json

Body

  • mappings_override object

    Mappings overrides to be applied to the destination index (optional)

    Hide mappings_override attributes Show mappings_override attributes object
    • all_field object
      Hide all_field attributes Show all_field attributes object
      • analyzer string Required
      • enabled boolean Required
      • omit_norms boolean Required
      • search_analyzer string Required
      • similarity string Required
      • store boolean Required
      • store_term_vector_offsets boolean Required
      • store_term_vector_payloads boolean Required
      • store_term_vector_positions boolean Required
      • store_term_vectors boolean Required
    • date_detection boolean
    • dynamic string

      Values are strict, runtime, true, or false.

    • dynamic_date_formats array[string]
    • dynamic_templates array[object]
    • _field_names object
      Hide _field_names attribute Show _field_names attribute object
      • enabled boolean Required
    • index_field object
      Hide index_field attribute Show index_field attribute object
      • enabled boolean Required
    • _meta object
      Hide _meta attribute Show _meta attribute object
      • * object Additional properties
    • numeric_detection boolean
    • properties object
    • _routing object
      Hide _routing attribute Show _routing attribute object
      • required boolean Required
    • _size object
      Hide _size attribute Show _size attribute object
      • enabled boolean Required
    • _source object
      Hide _source attributes Show _source attributes object
      • compress boolean
      • compress_threshold string
      • enabled boolean
      • excludes array[string]
      • includes array[string]
      • mode string

        Values are disabled, stored, or synthetic.

    • runtime object
      Hide runtime attribute Show runtime attribute object
      • * object Additional properties
        Hide * attributes Show * attributes object
        • fields object

          For type composite

          Hide fields attribute Show fields attribute object
          • * object Additional properties
        • fetch_fields array[object]

          For type lookup

          Hide fetch_fields attributes Show fetch_fields attributes object
          • field
          • format string
        • format string

          A custom format for date type runtime fields.

        • input_field string

          For type lookup

        • target_field string

          For type lookup

        • target_index string

          For type lookup

        • script object

          Painless script executed at query time.

          Hide script attributes Show script attributes object
          • params object

            Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

          • options object
        • type string Required

          Field type, which can be: boolean, composite, date, double, geo_point, ip,keyword, long, or lookup.

          Values are boolean, composite, date, double, geo_point, geo_shape, ip, keyword, long, or lookup.

    • enabled boolean
    • subobjects string

      Values are true or false.

    • _data_stream_timestamp object Generally available; Added in 7.16.0
      Hide _data_stream_timestamp attribute Show _data_stream_timestamp attribute object
      • enabled boolean Required
  • settings_override object

    Settings overrides to be applied to the destination index (optional)

    Hide settings_override attributes Show settings_override attributes object
    • 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.

    • 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
      • scheduler 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
      • rebalance 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.

      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
      • 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
    • 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
      • end_time string
      • start_time string
    • 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
        • ignore_dynamic_beyond_limit
      • 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
      • ignore_malformed boolean | string

    • indexing.slowlog object
      Hide indexing.slowlog attributes Show indexing.slowlog attributes object
      • level string
      • source number
      • reformat boolean
      • threshold object
    • 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
  • remove_index_blocks boolean

    If index blocks should be removed when creating destination index (optional)

    Default value is true.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • acknowledged boolean Required
    • index string Required
    • shards_acknowledged boolean Required
PUT /_create_from/{source}/{dest}
curl \
 --request PUT 'http://api.example.com/_create_from/{source}/{dest}' \
 --header "Content-Type: application/json" \
 --data '{"mappings_override":{"all_field":{"analyzer":"string","enabled":true,"omit_norms":true,"search_analyzer":"string","similarity":"string","store":true,"store_term_vector_offsets":true,"store_term_vector_payloads":true,"store_term_vector_positions":true,"store_term_vectors":true},"date_detection":true,"dynamic":"strict","dynamic_date_formats":["string"],"dynamic_templates":[{}],"_field_names":{"enabled":true},"index_field":{"enabled":true},"_meta":{"additionalProperty1":{},"additionalProperty2":{}},"numeric_detection":true,"properties":{},"_routing":{"required":true},"_size":{"enabled":true},"_source":{"compress":true,"compress_threshold":"string","enabled":true,"excludes":["string"],"includes":["string"],"mode":"disabled"},"runtime":{"additionalProperty1":{"fields":{"additionalProperty1":{},"additionalProperty2":{}},"fetch_fields":[{"format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"params":{},"options":{}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{},"additionalProperty2":{}},"fetch_fields":[{"format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"params":{},"options":{}},"type":"boolean"}},"enabled":true,"subobjects":"true","_data_stream_timestamp":{"enabled":true}},"settings_override":{"index":{},"mode":"string","routing_path":"string","soft_deletes":{"enabled":true,"retention_lease":{}},"sort":{"field":"string","order":"asc","mode":"min","missing":"_last"},"number_of_shards":"1","number_of_replicas":"0","number_of_routing_shards":42.0,"check_on_startup":"true","codec":"LZ4","routing_partition_size":42.0,"load_fixed_bitset_filters_eagerly":true,"hidden":"false","auto_expand_replicas":"false","merge":{"scheduler":{}},"search":{"idle":{},"slowlog":{"level":"string","source":42.0,"reformat":true}},"refresh_interval":"string","max_result_window":10000.0,"max_inner_result_window":100.0,"max_rescore_window":10000.0,"max_docvalue_fields_search":100.0,"max_script_fields":32.0,"max_ngram_diff":1.0,"max_shingle_diff":3.0,"blocks":{"read_only":true,"read_only_allow_delete":true,"read":true,"write":true,"metadata":true},"max_refresh_listeners":42.0,"analyze":{"max_token_count":42.0},"highlight":{"max_analyzed_offset":1000000.0},"max_terms_count":65536.0,"max_regex_length":1000.0,"routing":{"allocation":{},"rebalance":{}},"gc_deletes":"string","default_pipeline":"string","final_pipeline":"string","lifecycle":{"name":"string","indexing_complete":true,"origination_date":0.0,"parse_origination_date":true,"step":{},"rollover_alias":"","prefer_ilm":"true"},"provided_name":"string","creation_date":42.0,"creation_date_string":"string","uuid":"string","version":{"created":"string","created_string":"string"},"verified_before_close":true,"format":"string","max_slices_per_scroll":42.0,"translog":{"sync_interval":"string","durability":"request","flush_threshold_size":42.0,"retention":{}},"query_string":{"lenient":true},"priority":42.0,"top_metrics_max_size":42.0,"analysis":{"analyzer":{},"char_filter":{},"filter":{},"normalizer":{},"tokenizer":{}},"settings":{},"time_series":{"end_time":"string","start_time":"string"},"queries":{"cache":{"enabled":true}},"similarity":{},"mapping":{"coerce":true,"total_fields":{},"depth":{"limit":20.0},"nested_fields":{"limit":50.0},"nested_objects":{"limit":10000.0},"field_name_length":{"limit":42.0},"dimension_fields":{"limit":42.0},"source":{},"ignore_malformed":true},"indexing.slowlog":{"level":"string","source":42.0,"reformat":true,"threshold":{}},"indexing_pressure":{"memory":{"limit":42.0}},"store":{"type":"fs","allow_mmap":true,"stats_refresh_interval":"string"}},"remove_index_blocks":true}'