Painless lowercase of a keyword field


(SK) #1

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"
}


(SK) #2

Hi,

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

{

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


(system) #3

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