Filter data based on script result

Hi

The script shown in the "JSON Input" field below computes bandwidth utilization in percent of the interface's nominal bandwidth:

I'd like to display only those interfaces where the computed result of that script is >80. How can this be done?

Thanks for your help

David

PS: I am aware that my question is related to the unanswered question Show only the average values that are more than 80%.

Hi @dknecht,
Thanks for taking the time to post here in the forum.
If I understood your problem well and what you want to achieve, you may want to create this script as a separate scripted field. You can perform the same metric aggregation so you get the chart and then you can run a quick search on it from the search bar such as newly_scripted_field > 80.

Here is some info on scripted fields: https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Let me know if that would work.

Hi Elvis

Thanks for your suggestion. Unfortunately, I don't get it running.

Based on the Kibana documentation (see below) I get the impression that it might not work at all:

"Scripted field values are computed at query time so they aren’t indexed and cannot be searched using Kibana’s default query language." (see: https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

Is there anything I am misunderstanding?

This is how far I got trying to implement your suggestion (using Kibana 4.5.1):

/etc/elasticsearch/elasticsearch.yml:
...
script.inline: true
script.indexed: true

Define the scripted field:

Test the scripted field:

Thanks and kind regards

David

Wow, that's a pretty old version of Kibana. I think it's 4.x? I'm not sure if this has changed since then, but on current versions of the stack I can query or filter on a number type scripted field.

As @LeeDr points out, I am using 7.5.0 with KQL and it works fine querying the scripted field as I did. Your old version of Kibana doesn't have this capability I believe.

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