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

**URL:** <https://discuss.elastic.co/t/kibana-7-inline-script-wildcard-on-viz-converts-to-incorrect-filter-query-within-dash/355268>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [March 13, 2024, 1:07am UTC](https://discuss.elastic.co/t/kibana-7-inline-script-wildcard-on-viz-converts-to-incorrect-filter-query-within-dash/355268 "2024-03-13T01:07:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timc/32/101968_2.png) [@TimC](https://discuss.elastic.co/u/TimC)\
**Post date:** [March 13, 2024, 1:07am UTC](https://discuss.elastic.co/t/kibana-7-inline-script-wildcard-on-viz-converts-to-incorrect-filter-query-within-dash/355268/1 "2024-03-13T01:07:17Z")

</div>

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:

```auto
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 \>

```auto
{
  "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:

```auto
{
  "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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 10, 2024, 1:07am UTC](https://discuss.elastic.co/t/kibana-7-inline-script-wildcard-on-viz-converts-to-incorrect-filter-query-within-dash/355268/2 "2024-04-10T01:07:47Z")

</div>

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