Copy field value from one index to another index

Hello, I would like to know what is the best way to copy field value from one index to another existing index, base on a matching criteria.
For example.

I have index "indexOne" and target "indexTwo", here is an example of the document in indexOne

[
    {
          "field1": "value1",
          "field2": "value2",
          "field3": "value3" 
     }
]

And here is the example of the document in indexTwo:

[
    {
          "field1": "value1",
          "field4": "value4",
          "field5": "value5" 
     },
    {
          "field1": "value1.1",
          "field4": "value4",
          "field5": "value5" 
     }
]

I would like to add the fields "field2" and "field3" to the index "indexTwo" if "field1" match in both index. For example as a result, the result document will be the following:

[
    {
          "field1": "value1",
          "field4": "value4",
          "field5": "value5",
          "field2": "value2",
          "field3": "value3",
     },
    {
          "field1": "value1.1",
          "field4": "value4",
          "field5": "value5" 
     }
]

Thanks, let me know if this is confusing.

1 Like

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