And thanks to Kibana I want to do a pie chart which represent the repartition between (sum of haircut + sum of brushing) and (sum of waxing hair removal + sum of makeup).
Here :
Sum of brushing : 713.
Sum of haircut : 1860.
Sum of these two values : 2573. (76.97%).
Sum of waxing hair removal :340.
Sum of makeup : 430
Sum of these two values : 770 (23.03%).
And now I want a graph with these two bold values like this example :
Could you help me ? I Can't draw my pie chart ..
Ps : With metric, I just succed to have "2573" and "770" with :
Sum aggregation and JSON input : {"script" : "doc['brushing'].value + doc['haircut'].value"}
and
Sum aggregation and JSON input : {"script" : "doc['waxing hair removal'].value + doc['makeup'].value"}
But i'm still unable to have these two values on my pie chart
The splits in a pie chart are based on elasticsearch bucket aggregations, so each split is based on a group of documents. In order to split the pie chart the way you want, you need a way to slice up and group your documents based on the type of service that was provided. There's no way to split a pie chart on multiple metrics that are based on the same underlying group of documents.
You'd have more flexibility if you structure your data model a little differently. Try splitting each line item into its own document, so each document looks something like this:
Now, in your pie chart configuration you can do a filters aggregation. For one filter do service:(brushing OR haircut) and for the other do service:("waxing hair removal" OR makeup). Now you've got two buckets, one with documents representing hairdressing benefits, the other representing aesthetic benefits. Now in the metrics section of the pie chart configuration you just need to do a sum on the total field. That should generate the visualization you're looking for!
Since your data is just coming from a CSV, I would write a script or use a spreadsheet application or something like that to get the CSV into the required format before ingesting into ES.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.