admin管理员组文章数量:1243250
I'm wondering how to calculate (and build a bar-graph dashboard on top of it) average of list elements across documents/records that I have in ElasticSearch. Let me try to explain with a simple version:
Say I have three documents in ES, with each document having two array fields ('runners' - an array of strings, and 'runners_times' - an array of numbers, where elements in runners
and runners_times
are sorted so that the first element from the first list corresponds to the first element in the second list, so from document 1: person_a = 100, person_b = 120). Say my three documents/records in ES look like this:
- runners: [person_a, person_b], runners_times: [100, 120]
- runners: [person_a, person_c], runners_times: [90, 110]
- runners: [person_b, person_c], runners_times: [100, 130]
Now, what I want is a bar-graph that gives a list of all unique runners across all three documents (so, in this case, 'person_a', 'person_b', and 'person_c') with their corresponding average times. So, in my case, that would be:
person_a: 95 person_b: 110 person_c: 120
Any tip would be great. Thanks a lot :-)
I'm able to get a list of all unique value in runners
, but I'm not sure how to get an average of that person's times, since they are in a separate list.
Should I perhaps try with dictionaries? {'person_a': 100, 'person_b': 120} maybe? I tried that, too, but dictionaries get saved as a list of unfolded fields instead.
本文标签: kibanaAverage of list elements across many documentsrecords in ElasticSearchStack Overflow
版权声明:本文标题:kibana - Average of list elements across many documentsrecords in ElasticSearch - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740091901a2224025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论