Is merging index A and Index B, into and index C, is possible in elasticsearch 6.x?

Hi Friends,
I'm trying to merge two indices into one index without duplications of fields:
for example, if I have Index A called "sponge":

 PUT /sponge/_doc/1
{
  "doc_id" : "1",
  "account_name" : "squarepants",
   "something" : "one"
}

and an Index B called "bob"

  PUT /bob/_doc/2
{
  "doc_id" : "2",
  "account_name" : "squarepants",
  "something_else" : "two"
}

and I wanna merge "sponge" and "bob", into Index C called "spongebob", and that will look like so:

{
  "doc_id" : "3",
  "account_name" : "squarepants",
  "something" : "one"
  "something_else" : "two"
}

is it possible to somehow use _reindex to make this merge possible? or maybe some other es api that I can use to reach this outcome?
tnx a lot for any help and stay safe and at home these days:)

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