Dears,
Why reindex API does not copy original doc _version to new index?
Is there any trick to force it?
query:
GET test/_search?version=true
{
"query": {
"match_all": {}
}
}
result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test",
"_type" : "_doc",
"_id" : "2",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"counter" : 1,
"title" : "Allo",
"tags" : [
"green"
]
}
},
{
"_index" : "test",
"_type" : "_doc",
"_id" : "1",
"_version" : 2,
"_score" : 1.0,
"_source" : {
"counter" : 2,
"title" : "Hey",
"tags" : [
"red"
]
}
}
]
}
}
reidnex test index to new index test_ds:
POST _reindex
{
"source": {
"index": "test"
},
"dest": {
"index": "test_ds1"
}
}
query new index:
POST _reindex
{
"source": {
"index": "test"
},
"dest": {
"index": "test_ds1"
}
}
and result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_ds1",
"_type" : "_doc",
"_id" : "2",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"counter" : 1,
"title" : "Allo",
"tags" : [
"green"
]
}
},
{
"_index" : "test_ds1",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"_score" : 1.0,
"_source" : {
"counter" : 2,
"title" : "Hey",
"tags" : [
"red"
]
}
}
]
}
}
The _version of docs was changed.
Best Regards,
Dan