Hi, I'm new to Kibana and am testing out scripted fields functionality. I've used them a few times in the past, but am running into strange issues today.
Documents in my dataset contain a text key [classification_info]. I want to indicate in a new field called [price_percentage] if the [classification_info] contains the string "price_percentage".
However when writing a script using
doc['classification_info.keyword'].value.contains("price_percentage")
I see unexpected behavior. The result in the sample viewer is an empty array, and If I try to view results in Discover I get an error.
As a sanity check, I wrote the below scripted field to see whether or not my documents indeed have classification_info. It they do, I'll return 1, if not, I'll return 0
As you can see from the sample results, the first 10 documents checked have classification_info:
Next up I tested to see what happens when I try to return classification_info using the following modified script:
However, the resulting sample preview returns an empty array. This is strange because as we saw from the first script, we've already confirmed that these documents should include the field.
More concerning, if I save the script as is, when I try to review this index in the Discover pane I see the following error.
Please let me know if I need to provide any more details to further clarify.