# Showing documents with a certain index fiel

**URL:** <https://discuss.elastic.co/t/showing-documents-with-a-certain-index-fiel/120490>\
**Category:** Kibana\
**Created:** [February 19, 2018, 4:35pm UTC](https://discuss.elastic.co/t/showing-documents-with-a-certain-index-fiel/120490 "2018-02-19T16:35:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomak](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@tomak](https://discuss.elastic.co/u/tomak)\
**Post date:** [February 19, 2018, 4:35pm UTC](https://discuss.elastic.co/t/showing-documents-with-a-certain-index-fiel/120490/1 "2018-02-19T16:35:23Z")

</div>

I would like to make a pie with one slice being "good" and the other being "bad". a document is considered "bad" if it has a certain field. How can I do this?

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [February 21, 2018, 9:49am UTC](https://discuss.elastic.co/t/showing-documents-with-a-certain-index-fiel/120490/2 "2018-02-21T09:49:17Z")

</div>

there are a couple of ways you could try to solve this:

- at index time create additional field like `good` with boolean value
- or create a scripted field to check for this condition
- or use filter aggregation, where one filter would be: `{"exists":{"field":"machine.os.raw"}}` and the other one: `{"bool":{"must_not":{"exists":{"field":"machine.os.raw"}}}}`

i hope this gives you some ideas and helps you to solve your problem.

---

<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:** [March 21, 2018, 9:49am UTC](https://discuss.elastic.co/t/showing-documents-with-a-certain-index-fiel/120490/3 "2018-03-21T09:49:34Z")

</div>

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