# How to filter options from a field selected

**URL:** https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480
**Category:** Elasticsearch
**Created:** [May 11, 2022, 3:17pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480 "2022-05-11T15:17:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Srikanth\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanth_v/32/86839_2.png) [@Srikanth\_V](https://discuss.elastic.co/u/Srikanth_V)
#### Post date: [May 11, 2022, 3:17pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/1 "2022-05-11T15:17:19Z")

</div>

Hello,

Is there a possibility to filter values from the field that has been selected? For example, my field A has 20 options.

Scenario 1 -  
a) I want my field A to show only the necessary values - 8 of them

Scenario 2 -  
b) I want to show the remaining 12 options.

Please let me know if there is a possibility for this? Any sort of help will be greatly appreciated. Thanks in advance.

Srikanth

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 11, 2022, 5:17pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/2 "2022-05-11T17:17:56Z")

</div>

Hi.

Let me understand.  
You have a field, ex: array, and when you search for the term in this array, do you want only one element of the array in the return, not the whole document?

Ex: Doc

```auto
"gender" : [
             "Action",
             "Crime",
             "Thriller"
           ]

```

Search by action then return

```auto
"gender" : [
             "Action"
           ]

```

---

<div class="post-metadata">

### Author: ![Srikanth\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanth_v/32/86839_2.png) [@Srikanth\_V](https://discuss.elastic.co/u/Srikanth_V)
#### Post date: [May 12, 2022, 7:17am UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/3 "2022-05-12T07:17:14Z")

</div>

Hi,

Thanks for your reply. Here is what my requirement is -

1. I select the field in kibana - say x.keyword which has 20 options and I have 2 conditions, based on my filter on organization(2 items are available), I want to show either 8 options or 12 options.

Regards,  
Srikanth

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 12, 2022, 12:41pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/4 "2022-05-12T12:41:56Z")

</div>

Show your query so I can understand better.  
Am I understanding that your field is an array, or am I wrong?

---

<div class="post-metadata">

### Author: ![Srikanth\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanth_v/32/86839_2.png) [@Srikanth\_V](https://discuss.elastic.co/u/Srikanth_V)
#### Post date: [May 31, 2022, 12:23pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/5 "2022-05-31T12:23:53Z")

</div>

We found an alternative in the backend and it's taken care now 🙂 Thanks

---

<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: [June 28, 2022, 12:24pm UTC](https://discuss.elastic.co/t/how-to-filter-options-from-a-field-selected/304480/6 "2022-06-28T12:24:36Z")

</div>

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