datasweet / kibana-datasweet-formula

This Kibana plugin allows calculated metrics on any standard kibana visualizations.
Apache License 2.0
121 stars 34 forks source link

Error in visualization #50

Closed MrKuip closed 5 years ago

MrKuip commented 5 years ago

In Kibana 6.6.2 I get a popup with the text:

Error in Visualisation agg is undefined

How to Reproduce:

The popup with "agg is undefined" will show.

The undefined variable agg can be found in './ui/public/courier/search_source/search_source.js'

lfroment-datasweet commented 5 years ago

Hi @MrKuip , it seems that you are trying to ask Elasticsearch to sort your result by the output of Formula. This cannot be performed, because your Formula is computed in a Kibana context, based on the result of your query to Elasticsearch. As a matter of fact, Elastisearch knows nothing about your Formula, because it has not been computed yet. Regards

MrKuip commented 5 years ago

I' m asking kibana to sort.

The combobox 'order by' in kibana contains the metric 'metric Formula1'.

Are you saying that I should not choose that option because it doesnt work?

lfroment-datasweet commented 5 years ago

yes, this won't work because the sorting is executed by ES, before returning an answer to Kibana. Formula will be computed based on that answer. The Kibana UI lists any metric as a sorting choice, and we cannot prevent it to do so.

There is no simple way to circumvent this in Kibana.

MrKuip commented 5 years ago

Oke thanks for evaluating my issue.

MrKuip commented 5 years ago

Very cheeky question here: I believe this plugin will redundant if kibana supports the 'bucket script' aggregation. I'm using it now in 'Visual builder' and it works good but that has other problems.

Have you considered that you base this plugin on the 'bucket script' aggregation? This way ES will be responsible for sorting (and you have less code that can break)