Painless lowercase of a keyword field

Hi All,

I have a index with a field which is of type keyword. The data is stored in upper case. I want to use _update_by_query and convert it to lowercase using Painless. Could you please help.

sample document
{
"field1":"TEST"
}

Output needed after update:
{
"field1":"test"
}

1 Like

Hi,

I could find the solution myself. posting it for benefit of others

{

"script":
{
"inline": "ctx._source. field1 = ctx._source.field1.toLowerCase()"
}
}

7 Likes

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