Hello,
I try to merge 2 indexes into one.
The first index (index_1) looks like this:
{
"_index" : "index_1",
"_id" : "1",
"_source" : {
"a":"1"
}
},
{
"_index" : "index_1",
"_id" : "2",
"_source" : {
"a":"2"
}
}
The second index (index_2) looks like this:
{
"_index" : "index_2",
"_id" : "1",
"_source" : {
"a":"3"
}
}
Now I want to merge this two indexes into a new index (index_1_2):
{
"_index" : "index_1_2",
"_id" : "1",
"_source" : {
"a":"3"
}
},
{
"_index" : "index_1_2",
"_id" : "2",
"_source" : {
"a":"2"
}
}
In older versions (< 7.0.0) for me the reindex was working:
POST _reindex
{
"source": {
"index": ["index_1", "index_2"]
},
"dest": {
"index": "index_1_2"
}
}
But this is not working anymore. In the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)
is for this reindexing the following note:
"The Reindex API makes no effort to handle ID collisions so the last document written will "win" but the order isn’t usually predictable so it is not a good idea to rely on this behavior. Instead, make sure that IDs are unique using a script."
How can I solve this problem?
Thank you!
Oliver