How to append a document without knowing it's id?

What should I do if I don't know the id of the doc?

Here is my case:
I have a nested doc like:
{
"Name" : "ABC",
"Tag" : {
"Tag1" : "DEF",
"Tag2" : "GHI"
}
}

and another doc like:
{
"Name" : "XYZ",
"Tag" : {
"Tag1" : "DEF",
"Tag2" : "GHI"
}
}

I want to append them since they have same Tag1 and Tag2 values.
My final doc should be:
{
"Name" : "ABC", "XYZ"
"Tag" : {
"Tag1" : "DEF",
"Tag2" : "GHI"
}
}

I do not have the ID of the docs.
How to I append?

You can use Update by Query which allows applying an update to the resulting set of a search.

How do I Update by Query using the Java API?
Is it possible, since I cannot find the documentation under the Java API docs?

Can you try using this https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java ?

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