Kibana visualize metric I'm not able to subtract with _value

I'm trying to do a simple calculation but the value is different:

{
  "script": "_value"
}

{
  "script": "_value - 10"
}


Let me explain what the purpose is:
this metrics returns me the time that some asset was stopped, however I need it to return to me in percentage the time that was normalized.
I need something like this (1 - (_value / _value / 1249200)) * 100, however if you just divide it, the result will work, but if I try to add or subtract it is a problem.

Wouldnt it be easier to create a scripted field or even better a runtime field for that?
Than you do the calculation where Elasticsearch expects it and you have full control using painless. You would be also able to reuse this field in any other visualization..
Did you tried that?

Script field I don't think it will because I will need to do it in the sum, and I imagine that the script will pay each, however the value will be very prxomido document from zero. ja this runtime field I never did and I don’t even know how it would be u could help me?

[image]

I'm not 100% sure but I think what you are trying to is not possible at this place.
But what may works better for you is using TSVB. There you can define a scripted metric based on your query results. TSVB can also be shown as metric visualization.

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