Is there a way to use expressions when doing aggregations (using Datatable)?

(jc) #1


So do a count aggregation over terms with resuts looking like this:

term1   345
term2   249
term3   117

I would like to show a second column that would represent a percentage of total count, ex:

term1   345  3.45%
term2   249  2.47%
term3   117  2.22%

Does Kibana support something like this?
Can I do something like this for example?

{ "script" : "doc['word'].count/(TOTAL/100)" }

(Joe Fleming) #2

Currently, no, that's not something Kibana does out of the box, and I don't think that the Lucene query language allows you to get the total. I think the reason is that it's not something Elasticsearch does, and we have historically tried not to add features in Kibana that we can't do in Elasticsearch, though I think that mindset is changing.

I'm pretty confident that pipeline aggs would allow you to do this pretty easily, but Kibana currently doesn't provide any way to use them.

It's also possible that the new Painless scripting language in Elasticsearch will allow this, but I'm not really familiar with it myself, so you'd have to flip through the docs yourself to see if that's right.

Also, here's an issue in the Kibana repo to track this:

(system) #3

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