# Show count excluding 2nd index values from 1st index

**URL:** https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913
**Category:** Kibana
**Created:** [September 24, 2019, 5:14pm UTC](https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913 "2019-09-24T17:14:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tag\_v](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tag_v/32/47466_2.png) [@tag\_v](https://discuss.elastic.co/u/tag_v)
#### Post date: [September 24, 2019, 5:14pm UTC](https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913/1 "2019-09-24T17:14:34Z")

</div>

I have 2 Indices in Elasticsearch with below data. Need a query to visualize metric count as 2 which is documents count after excluding index2 eids from index1 eids.

**index1:** { "\_id":1, "eid":"E1" } { "\_id":2, "eid":"E2" } { "\_id":3, "eid":"E3" }

**index2:** { "\_id":1, "eid":"E1" } { "\_id":2, "eid":"E4" } { "\_id":3, "eid":"E5" }

**Required Result:**

count: 2

Resultant Documents: { "\_id":2, "eid":"E2" } { "\_id":3, "eid":"E3" }

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [September 25, 2019, 2:48pm UTC](https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913/2 "2019-09-25T14:48:17Z")

</div>

Hi @tag_v,

It's currently not possible to create this kind of visualization in Kibana. What's your specific use case? Maybe it's possible to work around the issue by changing the shape of the ingested data somehow.

---

<div class="post-metadata">

### Author: ![tag\_v](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tag_v/32/47466_2.png) [@tag\_v](https://discuss.elastic.co/u/tag_v)
#### Post date: [September 25, 2019, 3:35pm UTC](https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913/3 "2019-09-25T15:35:10Z")

</div>

Hello @flash1293,

My use case is to show count of distinct eids which are present only in index1 but not in index2 with sample input present in question.

Please suggest feasible ways.

Thanks in advance.

---

<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: [October 23, 2019, 3:35pm UTC](https://discuss.elastic.co/t/show-count-excluding-2nd-index-values-from-1st-index/200913/4 "2019-10-23T15:35:13Z")

</div>

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