Filter on scripted field not working

Hi,

I have created two scripted fields -

  1. Field1 - which uses doc['transactionData'].value
  2. Field2 - which uses params['_source']['transactionData']

Now, when I filter based on the Field1, it is working as expected. However, when I try to filter based on Field2, shards are failing. I had used the params property, because I was getting error while Field2 creation since my transactionData field was too big and read somewhere in the forum that I should use params instead of doc in such a case, which solved the issue. But I am unable to use Field2 as a filter.

I checked the DSL Query for the filter and it is as follows:

{
"script": {
"script": {
"source": "boolean compare(Supplier s, def v) {return s.get() == v;}compare(() -> { if(!doc['message.keyword'].empty && doc['message.keyword'].value.equals('Total Users Per Application Per Role'))\n{\n String strTranData = params['_source']['transactionData'];\n return strTranData.splitOnToken('_Application:')[1].splitOnToken(';')[0];\n}\n \nelse \n return 'NA';\n }, params.value);",
"lang": "painless",
"params": {
"value": "AdminV2"
}
}
}
}

which uses the code for the scripted Field2 inline inside the query. The issue here could be using 'params' for the scripted field creation. However, since the transactionData field is too big and hence I can't use doc. Any suggestions, on how to overcome this?

Could you please create an issue at https://github.com/elastic/kibana/issues/new?template=Bug_report.md

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