Hot to update single doc without id?

Ok, this might sound strange but i can´t do that simple task: I just want to update one document which has an unique identifier. I don´t know the ID and don´t want to get the id first.

Using '_update_by_query' i get down to the right result, but something like this doesn´t work:

POST index/entity/_update_by_query?conflicts=proceed
{
"query": {
"term": {
"unique_identifier": "12345678"
}
},
"terms": { "term": "value" , "another_term" : "another_value" }
}

(I want to update term & another_term with value and anoter_value)

Any help appreciated :slight_smile:

you need to specify a script to do the actual conversion, see the samples in the docs at https://www.elastic.co/guide/en/elasticsearch/reference/6.4/docs-update-by-query.html

Thanks.. Can you point me in the right direction for a little bit more documentation ? It seems that everybody understands scripting but i have no idea how that works :wink:

There are docs here for scripting. The update by query docs that @spinscale linked you to have a few examples of scripting in the update-by-query context.

Tyvm, Sir.

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