# Select several distinct fields

**URL:** <https://discuss.elastic.co/t/select-several-distinct-fields/126776>\
**Category:** Kibana\
**Created:** [April 4, 2018, 3:23pm UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776 "2018-04-04T15:23:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pzixel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pzixel/32/29568_2.png) [@Pzixel](https://discuss.elastic.co/u/Pzixel)\
**Post date:** [April 4, 2018, 3:23pm UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776/1 "2018-04-04T15:23:59Z")

</div>

Hello guys.

I'm looking forward using kibana and wonder how can I express in kibana aggregation following SQL pseudocode

```sql
SELECT DISTINCT id, version
FROM storage
WHERE level = 'Error'

```

I have one field named `id` and another named `version`. I'd like to display somehow all `id-versions` pairs for events with `Error` level.

How can it be done?

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 4, 2018, 7:10pm UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776/2 "2018-04-04T19:10:13Z")

</div>

Hi

we don't have distinct fields I think. But what your are trying to achieve seems pretty straightforward. You need to do a terms aggregation on id and version  
and can then do a 'count'-metric (if you care about that value) the "where level = ...' just needs to be a filter on the filter bar. Hope this helps. Let us know if this works for you.

Cheers  
Rashmi

---

<div class="post-metadata">

**Author:** ![Pzixel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pzixel/32/29568_2.png) [@Pzixel](https://discuss.elastic.co/u/Pzixel)\
**Post date:** [April 5, 2018, 8:43am UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776/3 "2018-04-05T08:43:12Z")

</div>

Sorry, I just didn't see any way to group overm ore than one row. After you said it's possible I finally found that another `split row` should be added to make it work. Thank you.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 5, 2018, 3:00pm UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776/4 "2018-04-05T15:00:36Z")

</div>

Glad it worked...

Cheers  
Rashmi

---

<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 3, 2018, 3:11pm UTC](https://discuss.elastic.co/t/select-several-distinct-fields/126776/5 "2018-05-03T15:11:14Z")

</div>

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