# Taking snapshots concurrently of each index in Elasticsearch

**URL:** <https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339>\
**Category:** Elasticsearch\
**Created:** [December 18, 2019, 1:56pm UTC](https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339 "2019-12-18T13:56:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishanjain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ishanjain/32/59637_2.png) [@ishanjain](https://discuss.elastic.co/u/ishanjain)\
**Post date:** [December 18, 2019, 1:57pm UTC](https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339/1 "2019-12-18T13:57:00Z")

</div>

Hi!

I have written a module which issues snapshot creation requests for an index and sends it off to a ES cluster. This module is deployed on ECS and can run issue snapshot creation requests concurrently.

Right now, The snapshot creation request looks like,

```
resp, err := esclient.SnapshotCreate(esRepository, snapshotName).
	WaitForCompletion(true).BodyJson(map[string]interface{}{
	"indices": "indexname",
	"metadata": map[string]string{
		"taken_by": "native_snapshot_ecs_task",
	},
}).Do(context.Background())
if err != nil {
	return time.Since(startTime), err
}

```

If ES cluster receives multiple requests in parallel, It goes ahead with the one that came first and returns a `illegal_state_exception` error. (`Error 500 (Internal Server Error): trying to modify or unregister repository that is currently used [type=illegal_state_exception]`).

Since, I am always only taking snapshot of 1 index/request and no two snapshot creation requests share an index, What can I do to make this all work?

I know there is, `include_global_state` setting but I am not sure if that is what I should be using?

---

<div class="post-metadata">

**Author:** ![Armin\_Braun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/armin_braun/32/20092_2.png) [@Armin\_Braun](https://discuss.elastic.co/u/Armin_Braun)\
**Post date:** [December 18, 2019, 5:35pm UTC](https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339/2 "2019-12-18T17:35:30Z")

</div>

Hi @ishanjain

> [@ishanjain](#):
>
> Since, I am always only taking snapshot of 1 index/request and no two snapshot creation requests share an index, What can I do to make this all work?

I'm afraid nothing. Parallel snapshot operations are currently simply not supported in a cluster without exception. This might change in the mid-term but for now you are limited to a single snapshot at a time per cluster, unfortunately.

---

<div class="post-metadata">

**Author:** ![ishanjain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ishanjain/32/59637_2.png) [@ishanjain](https://discuss.elastic.co/u/ishanjain)\
**Post date:** [December 19, 2019, 2:00pm UTC](https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339/3 "2019-12-19T14:00:06Z")

</div>

Okay, Thanks. We'll figure something out so we don't run in this situation.

---

<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:** [January 16, 2020, 2:15pm UTC](https://discuss.elastic.co/t/taking-snapshots-concurrently-of-each-index-in-elasticsearch/212339/4 "2020-01-16T14:15:07Z")

</div>

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