Roll over to a new index Added in 5.0.0

POST /{alias}/_rollover/{new_index}

Creates a new index for a data stream or index alias.

Path parameters

  • alias string Required

    Name of the data stream or index alias to roll over.

  • new_index string Required

    Name of the index to create. Supports date math. Data streams do not support this parameter.

Query parameters

  • dry_run boolean

    If true, checks whether the current index satisfies the specified conditions but does not perform a rollover.

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

  • timeout string

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

  • wait_for_active_shards number | string

    The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

application/json

Body

Responses

POST /{alias}/_rollover/{new_index}
curl \
 -X POST http://api.example.com/{alias}/_rollover/{new_index} \
 -H "Content-Type: application/json" \
 -d '{"aliases":{"additionalProperty1":{"filter":{},"index_routing":"string","is_hidden":true,"is_write_index":true,"routing":"string","search_routing":"string"},"additionalProperty2":{"filter":{},"index_routing":"string","is_hidden":true,"is_write_index":true,"routing":"string","search_routing":"string"}},"conditions":{"min_age":"string","max_age":"string","":42.0,"min_docs":42.0,"max_docs":42.0,"max_size_bytes":42.0,"min_size_bytes":42.0,"max_primary_shard_size_bytes":42.0,"min_primary_shard_size_bytes":42.0,"max_primary_shard_docs":42.0,"min_primary_shard_docs":42.0},"mappings":{"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":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"enabled":true,"subobjects":true,"_data_stream_timestamp":{"enabled":true}},"settings":{"additionalProperty1":{},"additionalProperty2":{}}}'
Request examples
{
  "aliases": {
    "additionalProperty1": {
      "filter": {},
      "index_routing": "string",
      "is_hidden": true,
      "is_write_index": true,
      "routing": "string",
      "search_routing": "string"
    },
    "additionalProperty2": {
      "filter": {},
      "index_routing": "string",
      "is_hidden": true,
      "is_write_index": true,
      "routing": "string",
      "search_routing": "string"
    }
  },
  "conditions": {
    "min_age": "string",
    "max_age": "string",
    "": 42.0,
    "min_docs": 42.0,
    "max_docs": 42.0,
    "max_size_bytes": 42.0,
    "min_size_bytes": 42.0,
    "max_primary_shard_size_bytes": 42.0,
    "min_primary_shard_size_bytes": 42.0,
    "max_primary_shard_docs": 42.0,
    "min_primary_shard_docs": 42.0
  },
  "mappings": {
    "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": {
            "type": "boolean"
          },
          "additionalProperty2": {
            "type": "boolean"
          }
        },
        "fetch_fields": [
          {
            "field": "string",
            "format": "string"
          }
        ],
        "format": "string",
        "input_field": "string",
        "target_field": "string",
        "target_index": "string",
        "script": {
          "source": "string",
          "id": "string",
          "params": {
            "additionalProperty1": {},
            "additionalProperty2": {}
          },
          "": "painless",
          "options": {
            "additionalProperty1": "string",
            "additionalProperty2": "string"
          }
        },
        "type": "boolean"
      },
      "additionalProperty2": {
        "fields": {
          "additionalProperty1": {
            "type": "boolean"
          },
          "additionalProperty2": {
            "type": "boolean"
          }
        },
        "fetch_fields": [
          {
            "field": "string",
            "format": "string"
          }
        ],
        "format": "string",
        "input_field": "string",
        "target_field": "string",
        "target_index": "string",
        "script": {
          "source": "string",
          "id": "string",
          "params": {
            "additionalProperty1": {},
            "additionalProperty2": {}
          },
          "": "painless",
          "options": {
            "additionalProperty1": "string",
            "additionalProperty2": "string"
          }
        },
        "type": "boolean"
      }
    },
    "enabled": true,
    "subobjects": true,
    "_data_stream_timestamp": {
      "enabled": true
    }
  },
  "settings": {
    "additionalProperty1": {},
    "additionalProperty2": {}
  }
}
Response examples (200)
{
  "acknowledged": true,
  "conditions": {
    "additionalProperty1": true,
    "additionalProperty2": true
  },
  "dry_run": true,
  "new_index": "string",
  "old_index": "string",
  "rolled_over": true,
  "shards_acknowledged": true
}