# Create visualization on kibana for one filed if the other filed is present in document

**URL:** <https://discuss.elastic.co/t/create-visualization-on-kibana-for-one-filed-if-the-other-filed-is-present-in-document/350116>\
**Category:** Kibana\
**Tags:** kql-kibana-query-language, kibana-plugin-development, visualisation\
**Created:** [December 29, 2023, 6:29am UTC](https://discuss.elastic.co/t/create-visualization-on-kibana-for-one-filed-if-the-other-filed-is-present-in-document/350116 "2023-12-29T06:29:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RameshNagargoje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshnagargoje/32/30212_2.png) [@RameshNagargoje](https://discuss.elastic.co/u/RameshNagargoje)\
**Post date:** [December 29, 2023, 6:29am UTC](https://discuss.elastic.co/t/create-visualization-on-kibana-for-one-filed-if-the-other-filed-is-present-in-document/350116/1 "2023-12-29T06:29:53Z")

</div>

I have use case is to create the pie chart for "name" present in documents when documents has a "status" field available.

We have several documents in an index; for all documents, we have "name" available, but the "status" field is available for some of the documents. I have to create the pie chart for the "name" if the "status" field is present in documents. and status field value can be ["PASSED", "FAILED", "INPROGRESS]

documents format having only a name field.

> {  
> "name": "RAMA",  
> "dateTime": "2023-12-28T16:52:33.859081",  
> ....  
> }

Documents having name and status field

> {  
> "name": "RAMA",  
> "dateTime": "2023-12-28T16:52:33.859081",  
> "status":"PASSED"  
> ....  
> }

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 29, 2023, 3:21pm UTC](https://discuss.elastic.co/t/create-visualization-on-kibana-for-one-filed-if-the-other-filed-is-present-in-document/350116/2 "2023-12-29T15:21:23Z")

</div>

With Lens you can filter for when the field exists

Put this in the KQL search bar at the top of the viz

`status: *`

Then the visualization will only be on the set of docs filtered that have that field.

---

<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:** [January 26, 2024, 3:21pm UTC](https://discuss.elastic.co/t/create-visualization-on-kibana-for-one-filed-if-the-other-filed-is-present-in-document/350116/3 "2024-01-26T15:21:42Z")

</div>

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