Filter on scripted field not working in Kibana UI

Using version 6.4.2.

I have created a dashboard which contains multiple normal fields and scripted fields.
On scripted fields, filtering works correctly; Standard filter queries are automatically created:
{ "query": { "match": { "dossier.label.raw": { "query": "ADVN", "type": "phrase" } } } }

However, when using a scripted field, the filter query does not work and never yields any results. This is an example of an automatically created filter query on a scripted field:
{ "script": { "script": { "inline": "boolean compare(Supplier s, def v) {return s.get() == v;}compare(() -> { doc['dossier.label.raw'] }, params.value);", "lang": "painless", "params": { "value": "ADVN" } } } }

When I manually correct this query to a standard filter query, the filtering actually works on scripted fields.
How can I get filtering to work out-of-the-box on scripted fields?

Hmm, everything looks like it should be working correctly. Is the exact value for the scripted field ADVN, or is that only a portion of the value?

Hi Lukas, thanks for your feedback. Yes, 'ADVN' is the exact value for the scripted field (and not a portion of the value).

Hmm, is your script simply the following?

doc['dossier.label.raw']

If so, you may want to consider changing it to something like this:

doc['dossier.label'].value

Hi Lukas, thanks for the input.
I got it to work with:

doc['dossier.label.raw'].value

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