Elasticsearch version is about 7.x I want to update all documents in an index and I find in the documentation that I have to use "_update_to_the_query". This is the code:
curl -XPOST 127.0.0.1:9200/hamlet-raw/_update_by_the_query -d'
{
"query": {
"match_all": {}
},
"script" : {
"speaker": "Hamlet"
}
}'
and I get this error:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Invalid type: expecting [_doc] but got [_update_by_the_query]"}],"type":"illegal_argument_exception","reason":"Invalid type: expecting [_doc] but got [_update_by_the_query]"},"status":400}
why? Any advice on update all documents by adding a new field and value ? thank you.