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?