Is it possible to do a scripted field for serial difference?

I am new to scripted fields and painless in general and I am wondering if it is possible to do a scripted field for serial difference to use in something where the option is not available like in the graphs?

regards,

That's not possible because a scripted field can only act on a single document - for serial difference you would need to "join in" information from other documents which is breaking some basic assumptions of how Elasticsearch works internally.

Using the aggregation is the way to go here. Where exactly do you want to see a serial difference? Maybe there is a work around it.

thanks for your reply

i have a counter that I need to know the difference between this latest count and the previous count and I was trying to set up a watcher for it to alert me when it is higher then it has been on average over the previous week

This should be possible to do with the Elasticsearch aggregation type serial diff

It should be possible to use aggregations in the input of a watcher.