I have this example mapping.
I need to update the field "shirt.color"
mapping
{
"shirts" : {
"mappings" : {
"properties" : {
"shirt" : {
"properties" : {
"brand" : {
"type" : "keyword"
},
"color" : {
"type" : "keyword"
},
"model" : {
"type" : "keyword"
}
}
},"tienda" : {
"type" : "keyword"
}
}
}
}
}`
data
{
"_index" : "shirts",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"tienda" : "mall",
"shirt.brand" : "gucci",
"shirt.color" : "red",
"shirt.model" : "slim"
}
}
I have tried this way
POST shirts/_update_by_query
POST shirts/_update_by_query?conflicts=proceed
{
"script": {
"inline": "ctx._source.shirt.color = params",
"lang": "painless",
"params": {"shirt.color" : "blue"}
},
"query": {
"bool": {
"filter": [
{ "term": { "tienda": "mall" }}
]
}
}
}
but it does not work
error