Filter with scripted field

Hi,

I have created a scripted field test and the script is

if (params['_source']['additional'] == null) {
   return -1
}
return params['_source']['additional'].length()

The type of the field is number.
This works fine in the sense that i can see the field and its correct value in discover. But when i try to apply filter of between i.e test: 10 to 100 i get an the below error

Error executing Painless script: 'boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { if (params['_source']['additional'] == null) { ...'.

Would someone please let me know how can i get this working.
Thanks in advance.

What is your elastic version?

I am using OpenDistro for Elasticsearch 1.13.1 which uses ElasticSearch version 7.10.2

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