Closed MrKuip closed 5 years ago
Hi, Datasweet Formula is intended only to compute some stuff from another metric or bucket set in your viz. You are trying to make it work without any reference to another metric/bucket, am I right?
No, i have 2 metrics defined. I changed the formula from '(agg1 / agg3) * 1000' to '1000' because I wanted to see if the formula was the problem. Did you try it the way I described? Should I post the export of my visualization? It happens with a term bucket and a timerange that results in 0 documents
OK, I reproduced. Indeed in a "no document found" situation, Kibana throws "no result found" if a bucket split is active, and a "0" if no bucket split is active (or Range bucket split). Same problem with or without Datasweet-Formula implied. So in the first case, Formula cannot calculate anything based on a "nil", thus, you got an error. In the second case, Formula does its job : 0/1000=0.
Are you saying that the problem is in Kibana and not in datasweet?
I still think it is in datasweet. I only get the error if I add an aggregation of type 'Datasweet Formula'. Any other agregation does not produce this error
I think the execution of the formula throws the error.
The error is generated by the plugin, because Kibana output is a "no result found". When Kibana output is a zero, the plugin does its job.
I never ever programmed in javascript but I think I solved the problem.
In file './decorators/lib/apply_formula.js' I changed a line in function 'mutate'. This is the original line: const isRowValue = isObject(table.rows[0][0]); I changed it in: const isRowValue = isObject(table.rows[0]) && isObject(table.rows[0][0]);
The now get a nice 'no results found' message in my visualization.
@tcharlot-datasweet
I get a popup when I run a vizualisation that has a datasweet formula. The message is:
Error in visualisation Cannot read property '0' or undefined.
The vizualization is a horizontal barchart with a datasweet formula: "100" (So just a number). It happens with the following 2 circumstances (both must be true):
I do NOT get an error when (either of the 2)
I'm using elasticsearch/ kibana 6.6.2