# How to clone multiple indices at once within Kibana DevTools

**URL:** <https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939>\
**Category:** Kibana\
**Created:** [September 22, 2022, 11:58am UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939 "2022-09-22T11:58:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fim01](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@fim01](https://discuss.elastic.co/u/fim01)\
**Post date:** [September 22, 2022, 11:58am UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/1 "2022-09-22T11:58:27Z")

</div>

Hello

Is it possible to clone multiple indices in one shot?

I tried:

> POST /test-13,test-14,test-15/\_clone/test-clone

Unfortunately I'll get an error:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index [test-13,test-14]",
        "index_uuid" : "_na_",
        "index" : "test-13,test-14"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index [test-13,test-14]",
    "index_uuid" : "_na_",
    "index" : "test-13,test-14"
  },
  "status" : 404
}

```

Questioning how to iterate over source indices within Kibana DevTools?

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [September 22, 2022, 2:33pm UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/2 "2022-09-22T14:33:34Z")

</div>

Hi @fim01. It looks like you are trying to concatenate multiple indices into a single index. The `_clone` endpoint does not support this as it only supports a single source index to a single destination index.

I believe you may want to review the [Index Lifecycle Management documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-management.html) instead. Particularly the section on [Managing existing indices](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-with-existing-indices.html) may help you.

---

<div class="post-metadata">

**Author:** ![fim01](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@fim01](https://discuss.elastic.co/u/fim01)\
**Post date:** [September 22, 2022, 2:55pm UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/3 "2022-09-22T14:55:54Z")

</div>

Thanks Nick for your reply.

ILM is in fact already active. The problem I try to solve. I've 350+ indices (each 4GB+) and want to save them for later use. \_reindex into a single index takes 12 days (approx. calculation) which is not acceptable for us.

Hence I tried with \_clone api which is extremly fast. But now I have to type manually 350 times different source and destination index name.

Hence my question, is there a for-loop available in Kibana DevTools?

It doesn't matter whether I have a single index or same number of indices after the \_clone.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [September 22, 2022, 3:03pm UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/4 "2022-09-22T15:03:31Z")

</div>

> Hence my question, is there a for-loop available in Kibana DevTools?

No, there is no for loop in DevTools. I would recommend something like a bash process. Perhaps you could modify [the example in the Reindex documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-reindex.html#docs-reindex-from-multiple-sources) to use the `_clone` endpoint?

---

<div class="post-metadata">

**Author:** ![fim01](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@fim01](https://discuss.elastic.co/u/fim01)\
**Post date:** [September 23, 2022, 12:29pm UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/5 "2022-09-23T12:29:22Z")

</div>

Thank you for the hint!  
Finally we performed the manipulations with a python script.

> curl -X POST [https://localhost:9200/srcidx/\_clone/dstidx?pretty](https://localhost:9200/srcidx/_clone/dstidx?pretty)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 21, 2022, 12:29pm UTC](https://discuss.elastic.co/t/how-to-clone-multiple-indices-at-once-within-kibana-devtools/314939/6 "2022-10-21T12:29:47Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
