I've created a Metric visualization with 2 metrics:
- Top hit aggregation on "name" field that I have
- Count aggregation
On top of that I created a filter to get only the results from the recent minute.
So, I get a count of the distinct names that were present in the recent minute.
Furthermore, I had to exclude some of these results by a "status" field - I wanted to get the count of the distinct names with that status "error" only.
So I added a Buckets Terms aggregation with include "ERROR".
It works well, but when there are no suitable results at all, I get "no results found" in the visualization, which looks quite ugly. I'd like it to show 0. How can I achieve that?
Is it possible in the metric visualization? If not, is there another visualization that can meet my needs?
Here is the visualization:
and here it is when no results are found:
Hi @Chenlrv can you please tell me if you used the TSVB metric visualization or a standard metric visualization or you created one on Canvas?
If you can send me also the version of Kibana you are running I can take a look and see if this is actually a bug or something that we haven't think of
Hi @markov00 , I used the standard metric visualization :
Kibana version is 7.9.0
Can you also send me the current configuration on the editor, I'm not sure I've 100% understood how you are configuring this and in particular where you used the top hit aggregation and the terms one.
Because if you are looking to have a metric that describes the number of unique faulty devices, you can simply have a unique count metric aggregation and then apply a filter on the error status code.
You are right, the top hit aggregation was disabled in the visualization. I use count aggregation with filter on "ERROR" status code
could you please post here the request and response available from the
Inspect panel because I've tested locally and I can't reproduce the issue:
Sure, for the exmaple I changed the filter to "WARNING" status (which gives no results found).
Thanks, what is the desired outcome with the specification of the
include: "WARNING" filter in the terms aggregation? what do you want to achieve with that? because this filters the returned bucket returning only buckets with that specific
status and in your case seems that you don't have buckets on the selected interval to satisfy that clause: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_filtering_values_4
I'm also seeing that you are specifying also another time filter
last minute and I think that will not produce the wanted result. I think this can be achieved with TSVB metric visualization as described in this other reply: Get visualization of missing data
I expect that if there are no such results, the metric will show 0 and not "no results found", that's the desired behavior. How can I achieve that? I use last minute filter because I want to show the number of devices that got status error in the last minute
@markov00 I tried the TSVB metric as you suggested, indeed it almost meets all of my needs - it does show count 0 when there are no results, but the font is too small, and could not find a way to make it bigger.. in the metric visualization the font size is customizable, we want it to look very big.
What you can do is to use the same TSVB configuration and use Markdown, you should be able to print out your text and change the css style for that increasing the font size as you prefer.
Could you please create an enhancement request for the font style/size of TSVB metric here so we can see if we can put that on our roadmap https://github.com/elastic/kibana/issues/new?template=Feature_request.md
@markov00 Markdown also lets me change the background color depends on the count number? I want to background color to be green on 0 and to be red when bigger than 0.
I'm sorry, unfortunately not at the moment
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.