Split index

Introduced 1.0

The split index API operation splits an existing read-only index into a new index, cutting each primary shard into some amount of primary shards in the new index.

Example

  1. PUT /sample-index1/_split/split-index1
  2. {
  3. "settings": {
  4. "index": {
  5. "number_of_shards": 4,
  6. "number_of_replicas": 2
  7. }
  8. },
  9. "aliases": {
  10. "sample-alias1": {}
  11. }
  12. }

copy

Path and HTTP methods

  1. POST /<source-index>/_split/<target-index>
  2. PUT /<source-index>/_split/<target-index>

Index naming restrictions

OpenSearch indexes have the following naming restrictions:

  • All letters must be lowercase.
  • Index names can’t begin with underscores (_) or hyphens (-).
  • Index names can’t contain spaces, commas, or the following characters:

    :, ", *, +, /, \, |, ?, #, >, or <

Path parameters

ParameterTypeDescription
<source-index>StringThe source index to split.
<target-index>StringThe index to create.

Query parameters

Your request must include the source and target indexes. All split index parameters are optional.

ParameterTypeDescription
<source-index>StringThe source index to split.
<target-index>StringThe index to create.
wait_for_active_shardsStringThe number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed.
cluster_manager_timeoutTimeHow long to wait for a connection to the cluster manager node. Default is 30s.
timeoutTimeHow long to wait for the request to return. Default is 30s.
wait_for_completionBooleanWhen set to false, the request returns immediately instead of after the operation is finished. To monitor the operation status, use the Tasks API with the task ID returned by the request. Default is true.
task_execution_timeoutTimeThe explicit task execution timeout. Only useful when wait_for_completion is set to false. Default is 1h.

Request body

The split index API operation creates a new target index, so you can specify any index settings and aliases to apply to the target index.

Example response

  1. {
  2. "acknowledged": true,
  3. "shards_acknowledged": true,
  4. "index": "split-index1"
  5. }

Index codec considerations

For index codec considerations, see Index codecs.