Scripted Field to check if the value of two attributes match or not

Hi there,

I'm trying to create a scripted field to compare 2 values:

doc['incoming_json_dict.customer.correspondenceLanguage'].value
and
doc['result_pack.detectedLanguage'].value

I tried out different way to check it but it doesn't work.
both are of type string, aggregatable and searchable.

any help to create the painless code to get for example True / False if the values are equal?

thanks and cheers,
Hugo

Did you try a script like doc['incoming_json_dict.customer.correspondenceLanguage'].value === doc['result_pack.detectedLanguage'].value? It should work with these settings:

Here's are links to our painless syntax reference page and a blog post on using painless in scripted fields. They provide some nice examples of painless scripts.

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