Filter syntax in Bucket Metrics

(Mike Conner) #1

Using Kibana 6.6
I'm trying to understand how to use filter aggregations with the metric visualizations. And am trying to start simple with some counts, with buckets by first letter of last name, over a range (e.g. A-L).
I've found that I can use regex:
patientName_.alphabeticFamilyName.keyword:/[B].*/
and by extension, a range would be: [A-L].* (This doesn't work in the search bar with the experimental features turned on), nor when adding a filter, unless I eded the Query DSL.
I can also use a range: [B TO C}

Before that, I tried this:
patientName_.alphabeticFamilyName.keyword >= B and patientName_.alphabeticFamilyName.keyword < C
This last gives a count that's too high (25 instead of 11 on my minimal test set), but I don't understand why. Is this not equivalent to the range?

Also, I tried adding an "other_bucket_key" as described in the docs, by adding it as JSON Input. It added it to the query, and returns it in the results, but but the visualization doesn't show it. Is there a way to do display the other bucket in a metric?

More generally: Is there a way to define an aggregation (e.g in Dev Tools) and use it for a visualization. It seems that doing it through the Metric UI is very limiting.