Kibana 7 inline script wildcard on viz converts to incorrect filter query within dash

I was trying to come up with a way to store filters with a Dashboard since I had read that is not possible, and I found this bug where inline is not converting to query dsl correctly when used between a visualization and a dashboard.

To replicate the issue:

Data is a string full of words. Example data could be:

field: "words_string"
entry1: "one,two,three,four,five"
entry2: "six,seven,eight,nine"
entry3: "two,four,six,eight"

I created a Visualization > Aggregation Based > Data Table
Metric Count
Split Rows > Terms > words_string
Advanced >

{
  "script": {
    "inline": "doc['words_string'].size() != 0 && doc['words_string'].value.contains('six') ? 'YES SIX' : 'NO SIX'",
    "lang": "painless"
  }
}

Save and add to dashboard
Select +Filter for value to create a filter

Elasticsearch Query DSL that is spawned contains the wrong query, no wildcard:

{
  "query": {
    "match_phrase": {
      "words_string": "YES SIX"
    }
  }
}

Hopefully the steps are reproducible without pics as the data is sensitive, though I could probably figure something out if necessary

I am wondering if this is a bug or if there is a workaround?

Thanks!
Tim C
IE

edit: Version 7.17.11

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