Reputation: 2030
I am trying to update multiple documents on elasticsearch that were created with a wrong (for us) country name.
I am trying to do so by using "update_by_query" plugin version 2.5.0 (that should work with ES 1.5.2). plugin page
This is what I've tried:
POST incidents/political/_update_by_query
{
"query":{
"filtered":{
"filter":{
"bool":{
"must":{
"term":{
"CountryName": "Cote d'Ivoire"
}
}
}
}
}
},
"script":{
"inline":"ctx._source.CountryName = newName",
"params":{
"newName":"Cote dIvoire"
}
}
}
and the result is:
{
"ok": true,
"took": 9,
"total": 2,
"updated": 0,
"indices": [
{
"incidents": {}
}
]
}
I can see that it is able to find those two records but can't update them for some reason.
I have enable the needed settings on config file:
script.inline: on
script.indexed: on
script.disable_dynamic: false
I am not sure what can be missing or wrong.
Upvotes: 1
Views: 84
Reputation: 840
Try to write the script part of your query like this:
"script" : "ctx._source.CountryName = 'Cote dIvoire'"
Let me know if it works.
Upvotes: 2