Creating a watcher to compare moving average values

Hello there,

I'm trying to build a watcher to compare two values for a moving average, one being the latest bucket moving average value and the other the moving average value for a bucket one month earlier (-1 Month offset) and I can't figure out how to access the value for the 1 month offset bucket. I have the following query:

"aggs": {
  "Current": {
    "date_histogram": {
      "field": "@timestamp",
      "calendar_interval": "day"
    },
    "aggs": {
      "average": {
        "avg": {
          "field": "RobotExecutionTime"
        }
      },
      "MA": {
        "moving_fn": {
          "buckets_path": "average",
          "window": 30,
          "script": "MovingFunctions.linearWeightedAvg(values)"
        }
      }
    }
  }

This query has both values I need, along with all the other results of the query and I'd like to know if I can filter it to only show the one with the latest timestamp and one with a timestamp from a month earlier.

I'd appreciate the help!

Anyone, please?

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