Pie gender based on heterogen value

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.

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

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

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

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

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