Painless SHA1 or other hash in scripted field

I have seen a few posts recommending to use sha1() from painless but I'm unable to make it work. I have a scripted field where I take 4 fields and want to turn them into a hash:

     x = doc['1'].value +'&' + doc['timestamp'].value.getMillis()+'&' + doc['2'].value +'&' + doc['3'].value
return x

How do I use the sha1() function?

These dont work:
return x.sha1()
return sha1(x)

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