i was trying canvas and not able to understand the marked 51%, how exactly it is coming and what does {getCell "percentage"} mean?
thanks in advance
i was trying canvas and not able to understand the marked 51%, how exactly it is coming and what does {getCell "percentage"} mean?
thanks in advance
Hi Vinit,
If you look in the expression editor for this element you can see how it is specifically filtering on gender to get a percentage of total rows. You can also see the expression get a rowCount and label it as "percentage" so getCell "percentage" is just referencing that calculated field.
esdocs index="kibana_sample_data_ecommerce" fields="customer_gender"
| ply by="customer_gender" expression={rowCount | as "percentage"}
| filterrows {getCell "customer_gender" | any {eq "FEMALE"}}
| markdown {getCell "percentage"} "%"
font={font family="Avenir" size=48 align="center" color="#eb6c66" weight="normal" underline=false italic=false}
If you're not familiar with the expression part, that's fine. The idea is somewhat simple though, it's just fetching and then transforming data by executing functions and passing the output into other functions. It's a bit like bash, if your familiar with that, where you can use the output of one command as the input to the next using the pipe syntax.
If you're curious to see how the data is modified along the way, you can remove parts of the expression and it will render whatever the last function outputs. So cutting all the way down to the first function, esdocs index="kibana_sample_data_ecommerce" fields="customer_gender"
, will show you a table of a bunch of data, which are documents coming from Elasticsearch.
If you add the next function, so you're left with esdocs index="kibana_sample_data_ecommerce" fields="customer_gender" | ply by="customer_gender" expression={rowCount | as "percentage"}
, you'll see that the data has been "rolled up" based on the customer_gender
field, and each unique entry there will have a corresponding "percentage" value that is the row count for the associated value.
Add the next function, leaving you with esdocs index="kibana_sample_data_ecommerce" fields="customer_gender" | ply by="customer_gender" expression={rowCount | as "percentage"} | filterrows {getCell "customer_gender" | any {eq "FEMALE"}}
, and you'll see that it removes all but the "FEMALE" row.
You can keep doing this all the way to the end until you get just a single value. getCell
is just one of many functions available, and its job is to pull a single value from a "cell" in the datatable.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.