# Unique count metric for array of fields

**URL:** <https://discuss.elastic.co/t/unique-count-metric-for-array-of-fields/116045>\
**Category:** Kibana\
**Created:** [January 18, 2018, 12:16pm UTC](https://discuss.elastic.co/t/unique-count-metric-for-array-of-fields/116045 "2018-01-18T12:16:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anton-putau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anton-putau/32/26827_2.png) [@anton-putau](https://discuss.elastic.co/u/anton-putau)\
**Post date:** [January 18, 2018, 12:16pm UTC](https://discuss.elastic.co/t/unique-count-metric-for-array-of-fields/116045/1 "2018-01-18T12:16:41Z")

</div>

After aggregation I have documents with below structure in a bucket.

{ ... array: [{ ... }, { ... }, { key: value }] }

Can I somehow apply unique count metric for key field? Thanks.

P.S

Does this [limitation](https://www.elastic.co/guide/en/kibana/master/nested-objects.html) mean I can't do aggregation or perform metrics on key fields/values like below ?

{ ... array: [{ ... }, { ... }, { key: value }] }

{ ... array: ['key1', ' key2'] }

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [January 18, 2018, 8:48pm UTC](https://discuss.elastic.co/t/unique-count-metric-for-array-of-fields/116045/2 "2018-01-18T20:48:13Z")

</div>

Unfortunately the format of your data is incompatible with Kibana's ability to run unique count metrics. Could you restructure your data so that it's not inside an array?

---

<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 15, 2018, 8:48pm UTC](https://discuss.elastic.co/t/unique-count-metric-for-array-of-fields/116045/3 "2018-02-15T20:48:19Z")

</div>

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