Hello Team,
I got a requirement that have to query and update some fields value with base64 code for all documents.
can we change the field value to base64 by using _update_by_query
API.
Ex:
POST test/_doc
{
"foo": "bar",
"bar": "foo",
"account": "123456789"
}
POST test/_update_by_query?wait_for_completion=true&conflicts=proceed
{
"script": "ctx._source.remove('account')=base64('account')",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "account"
}
}
]
}
}
}
Expected result
POST test/_doc
{
"foo": "bar",
"bar": "foo",
"account": "MTIzNDU2Nzg5Cg=="
}
Regards
Kannan P