# How to filter a different field when a value is selected in another field in Kibana?

**URL:** https://discuss.elastic.co/t/how-to-filter-a-different-field-when-a-value-is-selected-in-another-field-in-kibana/329762
**Category:** Kibana
**Created:** [April 11, 2023, 4:05pm UTC](https://discuss.elastic.co/t/how-to-filter-a-different-field-when-a-value-is-selected-in-another-field-in-kibana/329762 "2023-04-11T16:05:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![stramzik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stramzik/32/112158_2.png) [@stramzik](https://discuss.elastic.co/u/stramzik)
#### Post date: [April 11, 2023, 4:05pm UTC](https://discuss.elastic.co/t/how-to-filter-a-different-field-when-a-value-is-selected-in-another-field-in-kibana/329762/1 "2023-04-11T16:05:13Z")

</div>

hi,

Lets says I have the below index

```auto
PUT /testindex/
{
  "mappings": {
    "properties": {
      "field1": {
        "type": "keyword"
      },
"Data": {
        "type": "keyword"
      }
    }
  }
}

POST /testindex/_bulk?refresh
{"index":{}}
{"columnA": "A1", "sample":1 , "Data":"A2" }
{"index":{}}
{"columnA": "A1", "sample": 2, "Data":"A1" }
{"index":{}}
{"columnA": "A1", "sample": 3, "Data":"A1" }
{"index":{}}
{"columnA": "A2", "sample": 4, "Data":"A2" }
{"index":{}}
{"columnA": "A2", "sample": 5, "Data":"A2" }
{"index":{}}
{"columnA": "A2", "sample": 6, "Data":"A1" }

```

and i've created a Kibana Visualization for **columnA** and **sample** fields as below  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/3/a328f8e9dcc60341499e86feb9ed03c74b508d6e.png)

If I Select A1 in columnA I want the filter to be applied on both columnA and Data field  
Returning only these documents from the index resulting appropriate visualization aswell

```auto
{"columnA": "A1", "sample": 2, "Data":"A1" }
{"columnA": "A1", "sample": 3, "Data":"A1" }

```

![image](https://us1.discourse-cdn.com/elastic/original/3X/6/c/6c61bf22dab8690a42d894caa0009167afce7678.png)

I know this is achievable by two clicks first select A1 in **columnA** field and select A1 in **Data** field but I dont want to do that I want a filter to be applied on both the fields

This can be achieved with a dynamic Scripted field which changes based on selection on the Dashboard. However, I couldn't find any such option of Dynamic scripts/fields nor any other ways to achieve this.

Kindly advise how to achieve this  
thank you

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [April 15, 2023, 4:33am UTC](https://discuss.elastic.co/t/how-to-filter-a-different-field-when-a-value-is-selected-in-another-field-in-kibana/329762/2 "2023-04-15T04:33:18Z")

</div>

You can add a search directly in the top bar of the dashboard: `columnA=A1 AND Data=A2`.

---

<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: [May 13, 2023, 4:33am UTC](https://discuss.elastic.co/t/how-to-filter-a-different-field-when-a-value-is-selected-in-another-field-in-kibana/329762/3 "2023-05-13T04:33:19Z")

</div>

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