Search code examples
elasticsearchelasticsearch-painless

SHA1 in painless (elasticsearch)


How I can update SHA1 for a lot of millions records in index?

like...

{ "query": ... "script": "ctx._source.sha1 = sha1(ctx._source.field)" }

Painless has not built-in SHA1 function as is as groovy. Do exist a way without using client-side?
If I can't do this, how I can use python for this?


Solution

  • The Groovy, JavaScript, and Python scripting languages were deprecated in elasticsearch 5.0 and have been removed from 6.0 (see here). You must use painless.

    Here you can find my sha1 and sha256 painless implementations.