Max value of index with scripted field in visualizasion

Hello. I'm trying to make linear visualization with average workTime per document and max workTime throw all index. I have two dates: start and end process. So i created scripted field
doc['end_time'].value.toInstant().toEpochMilli() - doc['begin_time'].value.toInstant().toEpochMilli()
and made avg y-axes for this field.
But i can't understand how to draw max value of index.
I need chart like this:

Can u help me to understand how to make it?

you can use TSVB for that case: create the first average workTime series as you have already did.
then you create a new series for the maxworkTime and you have to overwrite the time interval settings to a value greater than the current time window (for example if you are looking for a 5 mins time interval, you can set the interval to 1 hour for example.

1 Like

TSVB looks like I'm looking for, but it doesn't work. I can choose only count aggregation.

I can't select other aggregation, although I can choose these aggregations in a line visualization.
Does TSVB support scripted fields to visualize?

Does TSVB support scripted fields to visualize? Or I need to create a new numeric field in the document and fill it.
My scripted field in index has numeric type. And I can use it as filter in TSVB.

You are right, actually TSVB doesn't support scripted field: you can find the reason here:

There possible workaround are:

  • add that value at index time as you suggested
  • use Vega to build the chart: it will allows you to create the query you are interested in and plot the line chart as you prefer

I tried to make TSVB visualization. When I set an interval more than windowed time I got one point, not a line.

This picture with 1 minute.

How to make it line? And how to make a line continuous?

Can you show me the configuration for the red series? both the metrics panel and the options panel?

Here is.