# JSON indexing in kibana

**URL:** <https://discuss.elastic.co/t/json-indexing-in-kibana/311265>\
**Category:** Elasticsearch\
**Created:** [August 3, 2022, 7:09am UTC](https://discuss.elastic.co/t/json-indexing-in-kibana/311265 "2022-08-03T07:09:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ritikapawar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ritikapawar/32/98580_2.png) [@Ritikapawar](https://discuss.elastic.co/u/Ritikapawar)\
**Post date:** [August 3, 2022, 7:09am UTC](https://discuss.elastic.co/t/json-indexing-in-kibana/311265/1 "2022-08-03T07:09:11Z")

</div>

I have created a index using kibana console

the sample JSON data format -

```auto
[{ 
"id":1,
"Data":"{'patient_name':'Amey','gender':'Male'}",
"added_on":"2021-09-28 17:58:16",
"added_by":0,
"status":1
},
{ 
"id":2,
"Data":"{'patient_name':'Shubham','gender':'Male'}",
"added_on":"2021-09-28 17:58:16",
"added_by":0,
"status":1
},
{ 
"id":3,
"Data":"{'patient_name':'Ritika','gender':'female'}",
"added_on":"2021-09-28 17:58:16",
"added_by":0,
"status":1
},
{ 
"id":4,
"Data":"{'patient_name':'Neha','gender':'female'}",
"added_on":"2021-09-28 17:58:16",
"added_by":0,
"status":1
}]

```

indexed data look like this

 ![patient_json](https://us1.discourse-cdn.com/elastic/original/3X/6/1/61ffde2cf6acb81eb2b45f225365c96e4824f072.png)

the data is in JSON format in which  
**Data** (field) have two fields inside it as **patient name** and **gender**

I want to get count of gender by using the gender field from **Data**

which will show the results like this  
 ![patient_gender_pie](https://us1.discourse-cdn.com/elastic/original/3X/b/b/bbb52a07eee257a7ac4cac5772dbf99e0c668faf.png)

Is there any way to do this in ES?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 3, 2022, 2:01pm UTC](https://discuss.elastic.co/t/json-indexing-in-kibana/311265/2 "2022-08-03T14:01:02Z")

</div>

You need to convert the Data String as a proper json field.

Then you will be able to do this.

You can do it on existing documents using a runtime field but it's better to do this at index time.

---

<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:** [August 31, 2022, 2:01pm UTC](https://discuss.elastic.co/t/json-indexing-in-kibana/311265/3 "2022-08-31T14:01:54Z")

</div>

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