Reindex without replica & documents are removed after reindexing

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

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?

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 (or Shrink index API | Elasticsearch Guide [8.2] | Elastic)?

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