Writing Scripted Field with conditional statements

Hi,

I wanted to write conditional statements in Scripted field.

Can i get some sample example how to return field from scripted field ?
Can i debug the conditions in scripted field ?

Thanks

1 Like

@Varun_Patel if you're using the Painless scripting language, the following is an example of a conditional statement:

if(doc['_type'].value == 'apache') {
  return true;
}

return false;

If you're going to use scripted fields, it'll be worthwhile to familiarize yourself with the Painless Scripting Language.

Currently, there isn't an interactive debugger.

2 Likes

@Brandon_Kobel thanks it does make sense.

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