# Reindex without replica & documents are removed after reindexing

**URL:** https://discuss.elastic.co/t/reindex-without-replica-documents-are-removed-after-reindexing/305903
**Category:** Elasticsearch
**Created:** [May 30, 2022, 7:42am UTC](https://discuss.elastic.co/t/reindex-without-replica-documents-are-removed-after-reindexing/305903 "2022-05-30T07:42:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![da-head0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/da-head0/32/106320_2.png) [@da-head0](https://discuss.elastic.co/u/da-head0)
#### Post date: [May 30, 2022, 7:42am UTC](https://discuss.elastic.co/t/reindex-without-replica-documents-are-removed-after-reindexing/305903/1 "2022-05-30T07:42:17Z")

</div>

Hi, I used methods below to reindex ES index, for change number of shards & replica.

```auto
curl -X PUT "ip:port/argocd-log-2022-05-29-reindexed?pretty" -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1, 
            "number_of_replicas" : 0 
        }
    }
}'

curl -X POST "ip:port/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
  "source": {
    "index": "argocd-log-2022-05-29"
  },
  "dest": {
    "index": "argocd-log-2022-05-29-reindexed"
  }
}
'

curl -X DELETE "ip:port/argocd-log-2022-05-29"

curl -X PUT "ip:port/argocd-log-2022-05-29?pretty" -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1, 
            "number_of_replicas" : 0 
        }
    }
}'

curl -X POST "ip:port/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
  "source": {
    "index": "argocd-log-2022-05-29-reindexed"
  },
  "dest": {
    "index": "argocd-log-2022-05-29"
  }
}
'

curl -X DELETE "ip:port/argocd-log-2022-05-29-reindexed"

```

But I found out this method reindex 6GB index(2 shards, 1 replica) -\> to 11GB index (1 shard, 0 replica). So I thought in that way, documents in replica are also reindexed to new index.

Is it true?

I also found out reindexing in the way I used, sometimes(not always) only recent documents are survived, and the documents before reindexed are removed.  
Can somebody tell me what I did wrong?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 30, 2022, 7:44am UTC](https://discuss.elastic.co/t/reindex-without-replica-documents-are-removed-after-reindexing/305903/2 "2022-05-30T07:44:51Z")

</div>

> [@da-head0](#):
>
> So I thought in that way, documents in replica are also reindexed to new index.
> 
> Is it true?

No, that's not possible. We'd need to understand the mappings you are using to comment further.

However why don't you just use [Split index API | Elasticsearch Guide [8.2] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.2/indices-split-index.html) (or [Shrink index API | Elasticsearch Guide [8.2] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.2/indices-shrink-index.html))?

---

<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: [June 27, 2022, 7:45am UTC](https://discuss.elastic.co/t/reindex-without-replica-documents-are-removed-after-reindexing/305903/3 "2022-06-27T07:45:09Z")

</div>

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