Hi, Does kibana support weighted average if yes, can someone shed some light on it ? or is there any way to write a query for same?
Thank you..
Hi, Does kibana support weighted average if yes, can someone shed some light on it ? or is there any way to write a query for same?
Thank you..
What are you weighting the values by? Something in each document or some fixed values? Off-hand, this seems like a candidate for using Scripted Fields in Kibana.
This blog has some good examples; https://www.elastic.co/blog/using-painless-kibana-scripted-fields
Regards,
Lee
Hi Lee, thanks for your response can i do below calculations ?
Data
if a person smoke more than three times habit_risk_score should double
final_risk per subject = habit_risk_score * weight
can you guide me on how to store new field "final_risk" in existing index and visualize it in Kibana
thank you.... 
Here's a good blog about scripted field in Kibana; https://www.elastic.co/blog/using-painless-kibana-scripted-fields
But note that scripted fields are calculated per document. So you wouldn't be able to use the total count of multiple docs for a subject to influence the weight.
Maybe you can calculate a risk score for each doc and then add them up?
Thanks Lee , i am trying this, can we use scripted field as input for other scripted field.
example :
First use regex to create a scripted field habits 'smoke'
Then create another scripted field score '2' value based on previous scripted field through if construct ?
I don't think you can use one scripted field inside another scripted field.
thank you ....will calculate it again when required... 
© 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.