Update by query on multiple indices in elastic search

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Update by query on multiple indices in elastic search

shubhada789
This post has NOT been accepted by the mailing list yet.
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?
Loading...