One thing that is not obvious is the way that parameters are passed into datasources in sub-expressions. For example, the filters
is implicitly sent into escount
here:
filters
| var_set name="completed" {/* implicit filters | */ escount}
But then when you have two var_set
calls in a row, the same behavior causes an error:
var_set name="completed" value=0
| var_set name="sent" value={escount}
Putting this together, you need to create the full chain of datafetching at each subexpression level.
In this case I also used a time filter control, but you can do it either way:
timefilterControl compact=true column="@timestamp" filterGroup="myGroup"
| render
var_set name="completed" value={filters | timefilter filterGroup="myGroup" | escount index="kibana_sample_data_logs" query="bytes:[100 TO *]"}
| var_set name="sent" value={filters | timefilter filterGroup="myGroup" | escount index="kibana_sample_data_logs" query="*"}
| math {string {var "completed"} " / " {var "sent"}}