TSVB Aggregation filter

I want to show a gauge with a value that is calculated via an aggregation, the issue is i want the aggregations to be based on a filter, such that

I have a count value that is (number of docs with attribute:A)
I have a count value that is (number of docs with attribute:B)

Currently you can only do a query that effects all calculations in the TSVB and theres not even an option to add a filter.

Is there a known work around for this?

I have read about script aggregations but not sure how to use that in TSVB.

I am using Elastic stack 7.9 and cannot upgrade due to dependencies.

TSVB offers the Filter Ratio function which lets you get the ratio of a function across two filters.

1 Like

Thanks @wylie that is useful to know, it does solve some of the problem. I phrased the original question wrong slightly, the filter im looking to use is a date range, the whole query is this,

% of tickets that have an invalid review field

a ticket is invalid if it,
is older than 30 days and does not have a review field
or
has a review field where the date is not greater than todays date

So the filter i need is to check if it has the field and if the value of the field is greater than todays date.

Im not sure how to do that in Lucene?

Most solutions I have for you involve upgrading.

TSVB filter ratio started using KQL instead of Lucene in 7.10, and this would let you use datemath like date > now. Another option is to add a runtime field in 7.12 (or scripted field in older versions) which will set a field on each document based on your criteria, but this only works with KQL- Lucene doesn't work with these script-based fields.

Your only option without upgrading is to use Vega. Vega has been fully supported since 7.10, but was much harder to use in 7.9 due to the lack of inspector and older versions. We still have docs for 7.9 Vega which you can use, but upgrading will make it easier.

Thanks again @wylie for the response, that is unfortunate but I appreciate the help, ill give vega a go.

Cheers

Follow up with solution,

Made do with a simplified pie chart

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.