Is it possible to take a field from one index and copy it to another existing index without loosing fields it already contains?
For example I have an index abc
having fields field_a
, field_b
, field_c
and index def
having fields field_d
, field_e
, field_f
. What I want to achieve is to have index def
having fields: field_d
, field_e
, field_f
(already existing in def
) and field_a
(taken from abc
). Both indices are identified by the same _id
but documents have different types.
I was trying to use _reindex API:
POST _reindex
{
"source": {
"index": "abc",
"_source": [
"field_a"
],
"query": {"match_all": {}}
},
"dest": {
"index": "def"
}
}
but it replaces currently existing documents in def
instead of just adding a field.
Currently, I'm using Elasticsearch 5.6.