# Pie gender based on heterogen value

**URL:** <https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023>\
**Category:** Kibana\
**Created:** [December 25, 2019, 6:00pm UTC](https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023 "2019-12-25T18:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamelgh](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kamelgh](https://discuss.elastic.co/u/kamelgh)\
**Post date:** [December 25, 2019, 6:00pm UTC](https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023/1 "2019-12-25T18:00:00Z")

</div>

Hi,

I would like to know how to create a pie using aggregation (or any else) to create 2 part : Male/Female.  
But I have only one field which can contains more than 2 value : Mr, Mrs, Mr., Mme...

WIth Dev Tools I am able to launch query whick works :

```
GET /orders/_search
{
  "size": 0,
  "aggs" : {
    "gender" : {
      "filters" : {
        "filters" : {
          "male" : { "regexp" : { "billing_address.title.keyword" : "mr|m" }},
          "female" : { "regexp" : { "billing_address.title.keyword" : "mrs|mme|ms|mlle" }}
        }
      }
    }
  }
}

```

But in Kibana, I don't know how set the visualization.

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [December 26, 2019, 3:45pm UTC](https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023/2 "2019-12-26T15:45:17Z")

</div>

Did you try to use filter aggregation in pie chart aggregations to see if it worked? If not the advanced setting - you might be able to set your parameters to do it.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html)

Here is an example for advanced JSON input [https://www.elastic.co/guide/en/kibana/current/supported-aggregations.html:](https://www.elastic.co/guide/en/kibana/current/supported-aggregations.html:)

```auto
n be solved by using the below script under the "JSON input" in Kibana

{
  "script": {
    "inline": "doc['system.process.cgroup.memory.mem.usage.bytes'].value / 1024 / 1024/1024",
    "lang": "painless"
  }
}

```

Hope this helps.  
Bhavya

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![kamelgh](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kamelgh](https://discuss.elastic.co/u/kamelgh)\
**Post date:** [December 26, 2019, 7:38pm UTC](https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023/3 "2019-12-26T19:38:28Z")

</div>

Thank you !!  
You're right. I am a newbie and I didn't saw filter aggregation option 😉

---

<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 23, 2020, 7:38pm UTC](https://discuss.elastic.co/t/pie-gender-based-on-heterogen-value/213023/4 "2020-01-23T19:38:30Z")

</div>

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