Taking average of a numeric field and customise it


I have a duration field of type number having duration in milliseconds. I want to take the average of it, and show it in kibana dashboard metrics as dd:hh:mm:ss format, or basically run a script over the average value to customise the format.

I have tried using scripted field to convert it to a human readable format. though it works perfectly for me, but then when i search for the scripted field in kibana dashboard, it gives me query_shard_exception.
so first question, can i make this scripted field as non-searchable? how?

second question, can i do the same thing using runtime field? where i can specify the format as duration and output format as "human-readable"?

The end goal is to show average duration in a human readable format in kibana metrics, and the field should be either searchable or doesn't show up in the search at all.

I am using 7.17 version.

Yes you can do this for runtime fields when you're editing/adding the field:

What is the shard error you're getting? Is it possible you're forgetting to check if the underlying field actually exists in the document?

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