# How to display unique values of a field of documents with geopoints contained in a geoshape

**URL:** <https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238>\
**Category:** Kibana\
**Created:** [January 19, 2018, 1:10pm UTC](https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238 "2018-01-19T13:10:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon24174512](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@anon24174512](https://discuss.elastic.co/u/anon24174512)\
**Post date:** [January 19, 2018, 1:10pm UTC](https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238/1 "2018-01-19T13:10:46Z")

</div>

Hello all,

I have documents with a Geopoint and ID field. I can have several documents with same ID. I want to list in a data table the unique id with a geopoint contained in a geoshape.

How can I do that ? I am considering of taking the geoshape bounds from an area selection from the coordinate map.

Thanks,

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [January 19, 2018, 4:13pm UTC](https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238/2 "2018-01-19T16:13:14Z")

</div>

I'm not sure if I understand the question correctly, so correct me if I'm wrong, but it sounds like you want to display all of the unique IDs that appear within particular geoshapes, displayed in a table?

If that's correct, I think you can achieve this with a `terms` agg nested under a `filters` agg. In the visualization editor, first click "Split Rows" and select the Filters aggregation. Add all of the geo shape queries you want. Now click "Add sub-buckets", "Split rows" again, and select a Terms aggregation and configure it for your ID field.

---

<div class="post-metadata">

**Author:** ![anon24174512](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@anon24174512](https://discuss.elastic.co/u/anon24174512)\
**Post date:** [January 23, 2018, 1:31pm UTC](https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238/3 "2018-01-23T13:31:17Z")

</div>

Thanks @Bargs, it works 😃

---

<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:** [February 20, 2018, 1:31pm UTC](https://discuss.elastic.co/t/how-to-display-unique-values-of-a-field-of-documents-with-geopoints-contained-in-a-geoshape/116238/4 "2018-02-20T13:31:33Z")

</div>

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