JSON indexing in kibana

I have created a index using kibana console

the sample JSON data format -

[{ 
"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

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

Is there any way to do this in ES?

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.