# Is it possible to restore a specific index from a datastream to a datastream from snapshot

**URL:** https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710
**Category:** Elasticsearch
**Tags:** datastreams, snapshot-and-restore
**Created:** [May 30, 2023, 6:12pm UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710 "2023-05-30T18:12:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Kay\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kay_khan/32/45028_2.png) [@Kay\_Khan](https://discuss.elastic.co/u/Kay_Khan)
#### Post date: [May 30, 2023, 6:12pm UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710/1 "2023-05-30T18:12:18Z")

</div>

Recently we migrated our elasticsearch cluster and used snapshot/restore to do this.

Unfortunately we forgot about a change we made to the lifecycle policy of a the apm traces datastream. Which meant data older than 90 days were automatically deleted.

I can see in the snapshot that the data indexes exist

```auto
.ds-traces-apm.rum-default-2022.08.07-000003
.ds-traces-apm.rum-default-2022.09.06-000004
.ds-traces-apm.rum-default-2022.10.06-000006
.ds-traces-apm.rum-default-2022.11.05-000007
.ds-traces-apm.rum-default-2022.12.05-000009

```

But when i come to restore just these indexes, i can only select the entire data stream. ( **should i select the entire data stream?, what will happen to the current index** )

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/6/36082800e19e342f859ebadac0e2464350d85a0e.png)

Is it possible to restore a specific index to a data stream?

I can't see specific indexes in the drop down, but if i copy and paste the exact name `.ds-traces-apm.rum-default-2022.08.07-000003` it will restore. but im left with the problem that the index that i restored is not associated with the data stream?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/8/187a4de786a1b4f102b27b52d7d3ed59f64dc8d3.png)

Is there a way to do this properly?

---

<div class="post-metadata">

### Author: ![jhershcopf](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@jhershcopf](https://discuss.elastic.co/u/jhershcopf)
#### Post date: [June 7, 2023, 1:34pm UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710/2 "2023-06-07T13:34:58Z")

</div>

We have the same question. We lost both a primary and replica shard from one of our indices and wanted to restore that single index.

---

<div class="post-metadata">

### Author: ![Gautier\_Franchini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gautier_franchini/32/57688_2.png) [@Gautier\_Franchini](https://discuss.elastic.co/u/Gautier_Franchini)
#### Post date: [July 5, 2023, 9:40am UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710/3 "2023-07-05T09:40:32Z")

</div>

> [@Kay\_Khan](#):
>
> but im left with the problem that the index that i restored is not associated with the data stream?

Any new on "how to link restored index or any index" to a current datastream ?

Following a restore, I've multiple indices that are not associated with the current datastream anymore 😕

> The procedure I followed is this one: [Restore a managed data stream or index | Elasticsearch Guide [8.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-and-snapshots.html)

---

<div class="post-metadata">

### Author: ![Gautier\_Franchini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gautier_franchini/32/57688_2.png) [@Gautier\_Franchini](https://discuss.elastic.co/u/Gautier_Franchini)
#### Post date: [July 5, 2023, 10:50am UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710/4 "2023-07-05T10:50:47Z")

</div>

In order to fix the no more linked indices, we can use the api:

```auto
POST _data_stream/_modify
{
  "actions": [
  
    {
      "add_backing_index": {
        "data_stream": "lyourdsnamehere-default",
        "index": ".ds-logs-yourdsnamehere-2023.06.02-000085"
      }
    }
  ]
}

```

---

<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: [August 2, 2023, 10:50am UTC](https://discuss.elastic.co/t/is-it-possible-to-restore-a-specific-index-from-a-datastream-to-a-datastream-from-snapshot/334710/5 "2023-08-02T10:50:48Z")

</div>

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