I have the following data in elastic search
http://localhost:9200/index1,index2/_search?pretty{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "index1",
"_type" : "type1",
"_id" : "AVYrq0yrVMqtNNfFgqnN",
"_score" : 1.0,
"_source" : {
"clientport" : "1000",
"clientip" : "10.10.10.10"
}
}, {
"_index" : "index2",
"_type" : "type2",
"_id" : "AVYrsA5jVMqtNNfFgqnT",
"_score" : 1.0,
"_source" : {
"userid" : "12345",
"NAT-IP" : "10.10.10.10",
"NAT-PORT" : "1000"
}
} ]
}
}
I want to match (clientip and clientport) of index1/type1 with (NAT-IP and NAT-PORT) of index2/type2 and if they are equal then insert userid field in the index1/type1/ json.
I know I can write a query using _update_by_query api but how to handle multiple indices in this case? Can someone help me?