Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving Function linearWeightedAvg consistently under-reports value #113751

Open
garethhumphriesgkc opened this issue Sep 29, 2024 · 7 comments
Open
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@garethhumphriesgkc
Copy link

Elasticsearch Version

8.15.2

Installed Plugins

No response

Java Version

bundled

OS Version

ubuntu 24.04

Problem Description

The linearWeightedAvg moving function appears to consistently return lower than expected values. Consider the below query where I calculate four moving averages - three of them look completely believable, but linearWeightedAvg is consistently low.

Full repro below, but the first three results from it offer the raw values of:

  • 15.3984375
  • 15.3984375
  • 15.703125

We can calculate the mean of these to be exactly 15.5, and can agree that any moving function operating over these three values should return something between 15.4 and 15.7. Consider the below results:

          "unweightedAvg_of_temperature": {
            "value": 15.5
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.329241071428571
          },
          "ewma_of_temperature": {
            "value": 15.42890625
          },
          "holt_of_temperature": {
            "value": 15.42890625
          }

The unweighted average matches our calculated mean perfectly. ewma and holt fall within the expected range, but linearWeighted is well out of bands.

Also worth noting from the below full results is that first two values of linearWeighted (before the window size of 3 can be satisfied) are much lower than expected - 7.69921875 and 11.548828125.

Lastly, and perhaps unrelated, but I would have expected the other two weighted averages to put more weight on the later data points, which being larger I would have thought would return a value higher than the mean in this case, not lower?

Full query and results below.

Query:

POST weather-*/_search
{
  "size": 0,
  "query": {
    "range": {
      "@timestamp": {
        "gte": "now-1h/h",
        "lte": "now/h"
      }
    }
  },
  "aggs": {
    "temperature_histo": {
      "date_histogram": {
        "field": "@timestamp",
        "calendar_interval": "1m"
      },
      "aggs": {
        "average_temperature": {
          "avg": {
            "field": "temperature_C"
          }
        },
        "unweightedAvg_of_temperature": {
          "moving_fn": {
            "buckets_path": "average_temperature",
            "window": 3,
            "shift": 1,
            "script": "MovingFunctions.unweightedAvg(values)"
          }
        },
        "linearWeightedAvg_of_temperature": {
          "moving_fn": {
            "buckets_path": "average_temperature",
            "window": 3,
            "shift": 1,
            "script": "MovingFunctions.linearWeightedAvg(values)"
          }
        },
        "ewma_of_temperature": {
          "moving_fn": {
            "buckets_path": "average_temperature",
            "window": 3,
            "shift": 1,
            "script": "MovingFunctions.ewma(values, 0.1)"
          }
        },
        "holt_of_temperature": {
          "moving_fn": {
            "buckets_path": "average_temperature",
            "window": 3,
            "shift": 1,
            "script": "MovingFunctions.holt(values, 0.1, 0.1)"
          }
        }
      }
    }
  }
}

Results:

{
  "took": 59,
  "timed_out": false,
  "_shards": {
    "total": 25,
    "successful": 25,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 50,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "temperature_histo": {
      "buckets": [
        {
          "key_as_string": "2024-09-29T22:01:00.000Z",
          "key": 1727647260000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.3984375
          },
          "unweightedAvg_of_temperature": {
            "value": 15.3984375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 7.69921875
          },
          "ewma_of_temperature": {
            "value": 15.3984375
          },
          "holt_of_temperature": {
            "value": 15.3984375
          }
        },
        {
          "key_as_string": "2024-09-29T22:02:00.000Z",
          "key": 1727647320000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.3984375
          },
          "unweightedAvg_of_temperature": {
            "value": 15.3984375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 11.548828125
          },
          "ewma_of_temperature": {
            "value": 15.3984375
          },
          "holt_of_temperature": {
            "value": 15.3984375
          }
        },
        {
          "key_as_string": "2024-09-29T22:03:00.000Z",
          "key": 1727647380000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.703125
          },
          "unweightedAvg_of_temperature": {
            "value": 15.5
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.329241071428571
          },
          "ewma_of_temperature": {
            "value": 15.42890625
          },
          "holt_of_temperature": {
            "value": 15.42890625
          }
        },
        {
          "key_as_string": "2024-09-29T22:04:00.000Z",
          "key": 1727647440000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:05:00.000Z",
          "key": 1727647500000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.796875
          },
          "unweightedAvg_of_temperature": {
            "value": 15.6328125
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.456473214285714
          },
          "ewma_of_temperature": {
            "value": 15.465703125000001
          },
          "holt_of_temperature": {
            "value": 15.468445312500002
          }
        },
        {
          "key_as_string": "2024-09-29T22:06:00.000Z",
          "key": 1727647560000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.09375
          },
          "unweightedAvg_of_temperature": {
            "value": 15.864583333333334
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.654017857142858
          },
          "ewma_of_temperature": {
            "value": 15.750625000000001
          },
          "holt_of_temperature": {
            "value": 15.75146875
          }
        },
        {
          "key_as_string": "2024-09-29T22:07:00.000Z",
          "key": 1727647620000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 16.03125
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.799107142857142
          },
          "ewma_of_temperature": {
            "value": 15.864218750000001
          },
          "holt_of_temperature": {
            "value": 15.866890625
          }
        },
        {
          "key_as_string": "2024-09-29T22:08:00.000Z",
          "key": 1727647680000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 16.197916666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.912946428571429
          },
          "ewma_of_temperature": {
            "value": 16.12390625
          },
          "holt_of_temperature": {
            "value": 16.124890625
          }
        },
        {
          "key_as_string": "2024-09-29T22:09:00.000Z",
          "key": 1727647740000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:10:00.000Z",
          "key": 1727647800000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.5
          },
          "unweightedAvg_of_temperature": {
            "value": 16.333333333333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.042410714285714
          },
          "ewma_of_temperature": {
            "value": 16.24125
          },
          "holt_of_temperature": {
            "value": 16.242093750000002
          }
        },
        {
          "key_as_string": "2024-09-29T22:11:00.000Z",
          "key": 1727647860000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.463541666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.154017857142858
          },
          "ewma_of_temperature": {
            "value": 16.34484375
          },
          "holt_of_temperature": {
            "value": 16.346671875
          }
        },
        {
          "key_as_string": "2024-09-29T22:12:00.000Z",
          "key": 1727647920000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.209821428571429
          },
          "ewma_of_temperature": {
            "value": 16.517812499999998
          },
          "holt_of_temperature": {
            "value": 16.51865625
          }
        },
        {
          "key_as_string": "2024-09-29T22:13:00.000Z",
          "key": 1727647980000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:14:00.000Z",
          "key": 1727648040000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:15:00.000Z",
          "key": 1727648100000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:16:00.000Z",
          "key": 1727648160000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.5
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.183035714285714
          },
          "ewma_of_temperature": {
            "value": 16.584375
          },
          "holt_of_temperature": {
            "value": 16.584375
          }
        },
        {
          "key_as_string": "2024-09-29T22:17:00.000Z",
          "key": 1727648220000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:18:00.000Z",
          "key": 1727648280000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.196428571428571
          },
          "ewma_of_temperature": {
            "value": 16.5853125
          },
          "holt_of_temperature": {
            "value": 16.584468750000003
          }
        },
        {
          "key_as_string": "2024-09-29T22:19:00.000Z",
          "key": 1727648340000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.209821428571429
          },
          "ewma_of_temperature": {
            "value": 16.517812499999998
          },
          "holt_of_temperature": {
            "value": 16.51865625
          }
        },
        {
          "key_as_string": "2024-09-29T22:20:00.000Z",
          "key": 1727648400000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:21:00.000Z",
          "key": 1727648460000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:22:00.000Z",
          "key": 1727648520000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:23:00.000Z",
          "key": 1727648580000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:24:00.000Z",
          "key": 1727648640000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:25:00.000Z",
          "key": 1727648700000,
          "doc_count": 1,
          "average_temperature": {
            "value": 17
          },
          "unweightedAvg_of_temperature": {
            "value": 16.729166666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.397321428571429
          },
          "ewma_of_temperature": {
            "value": 16.634375000000002
          },
          "holt_of_temperature": {
            "value": 16.634375000000002
          }
        },
        {
          "key_as_string": "2024-09-29T22:26:00.000Z",
          "key": 1727648760000,
          "doc_count": 2,
          "average_temperature": {
            "value": 17.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 16.932291666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.600446428571429
          },
          "ewma_of_temperature": {
            "value": 16.69125
          },
          "holt_of_temperature": {
            "value": 16.694906250000003
          }
        },
        {
          "key_as_string": "2024-09-29T22:27:00.000Z",
          "key": 1727648820000,
          "doc_count": 1,
          "average_temperature": {
            "value": 17.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 17.135416666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.716517857142858
          },
          "ewma_of_temperature": {
            "value": 17.03859375
          },
          "holt_of_temperature": {
            "value": 17.040421874999996
          }
        },
        {
          "key_as_string": "2024-09-29T22:28:00.000Z",
          "key": 1727648880000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:29:00.000Z",
          "key": 1727648940000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 16.901041666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.357142857142858
          },
          "ewma_of_temperature": {
            "value": 17.1125
          },
          "holt_of_temperature": {
            "value": 17.1125
          }
        },
        {
          "key_as_string": "2024-09-29T22:30:00.000Z",
          "key": 1727649000000,
          "doc_count": 2,
          "average_temperature": {
            "value": 15.99609375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.498697916666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.969308035714286
          },
          "ewma_of_temperature": {
            "value": 17.000859375
          },
          "holt_of_temperature": {
            "value": 16.992703125000002
          }
        },
        {
          "key_as_string": "2024-09-29T22:31:00.000Z",
          "key": 1727649060000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.8984375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.063802083333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.712053571428571
          },
          "ewma_of_temperature": {
            "value": 16.229960937500003
          },
          "holt_of_temperature": {
            "value": 16.227253906250002
          }
        },
        {
          "key_as_string": "2024-09-29T22:32:00.000Z",
          "key": 1727649120000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.8984375
          },
          "unweightedAvg_of_temperature": {
            "value": 15.930989583333334
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.641183035714286
          },
          "ewma_of_temperature": {
            "value": 15.9775390625
          },
          "holt_of_temperature": {
            "value": 15.97666015625
          }
        },
        {
          "key_as_string": "2024-09-29T22:33:00.000Z",
          "key": 1727649180000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:34:00.000Z",
          "key": 1727649240000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.5
          },
          "unweightedAvg_of_temperature": {
            "value": 16.098958333333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.885044642857142
          },
          "ewma_of_temperature": {
            "value": 15.95859375
          },
          "holt_of_temperature": {
            "value": 15.95859375
          }
        },
        {
          "key_as_string": "2024-09-29T22:35:00.000Z",
          "key": 1727649300000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.330729166666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.097098214285714
          },
          "ewma_of_temperature": {
            "value": 16.022109375
          },
          "holt_of_temperature": {
            "value": 16.0275234375
          }
        },
        {
          "key_as_string": "2024-09-29T22:36:00.000Z",
          "key": 1727649360000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:37:00.000Z",
          "key": 1727649420000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.209821428571429
          },
          "ewma_of_temperature": {
            "value": 16.517812499999998
          },
          "holt_of_temperature": {
            "value": 16.51865625
          }
        },
        {
          "key_as_string": "2024-09-29T22:38:00.000Z",
          "key": 1727649480000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.59375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.223214285714286
          },
          "ewma_of_temperature": {
            "value": 16.59375
          },
          "holt_of_temperature": {
            "value": 16.59375
          }
        },
        {
          "key_as_string": "2024-09-29T22:39:00.000Z",
          "key": 1727649540000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:40:00.000Z",
          "key": 1727649600000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:41:00.000Z",
          "key": 1727649660000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:42:00.000Z",
          "key": 1727649720000,
          "doc_count": 2,
          "average_temperature": {
            "value": 16.546875
          },
          "unweightedAvg_of_temperature": {
            "value": 16.578125
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.203125
          },
          "ewma_of_temperature": {
            "value": 16.5890625
          },
          "holt_of_temperature": {
            "value": 16.5890625
          }
        },
        {
          "key_as_string": "2024-09-29T22:43:00.000Z",
          "key": 1727649780000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 16.447916666666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.042410714285714
          },
          "ewma_of_temperature": {
            "value": 16.55046875
          },
          "holt_of_temperature": {
            "value": 16.550046875
          }
        },
        {
          "key_as_string": "2024-09-29T22:44:00.000Z",
          "key": 1727649840000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 16.317708333333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.9375
          },
          "ewma_of_temperature": {
            "value": 16.4815625
          },
          "holt_of_temperature": {
            "value": 16.478468749999998
          }
        },
        {
          "key_as_string": "2024-09-29T22:45:00.000Z",
          "key": 1727649900000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 16.203125
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.888392857142858
          },
          "ewma_of_temperature": {
            "value": 16.203125
          },
          "holt_of_temperature": {
            "value": 16.203125
          }
        },
        {
          "key_as_string": "2024-09-29T22:46:00.000Z",
          "key": 1727649960000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:47:00.000Z",
          "key": 1727650020000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:48:00.000Z",
          "key": 1727650080000,
          "doc_count": 1,
          "average_temperature": {
            "value": 17.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 16.567708333333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.357142857142858
          },
          "ewma_of_temperature": {
            "value": 16.3125
          },
          "holt_of_temperature": {
            "value": 16.3125
          }
        },
        {
          "key_as_string": "2024-09-29T22:49:00.000Z",
          "key": 1727650140000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:50:00.000Z",
          "key": 1727650200000,
          "doc_count": 2,
          "average_temperature": {
            "value": 16.8984375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.799479166666668
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.498883928571429
          },
          "ewma_of_temperature": {
            "value": 16.37109375
          },
          "holt_of_temperature": {
            "value": 16.3809375
          }
        },
        {
          "key_as_string": "2024-09-29T22:51:00.000Z",
          "key": 1727650260000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.40625
          },
          "unweightedAvg_of_temperature": {
            "value": 16.8671875
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.330357142857142
          },
          "ewma_of_temperature": {
            "value": 17.171953125
          },
          "holt_of_temperature": {
            "value": 17.168367187500003
          }
        },
        {
          "key_as_string": "2024-09-29T22:52:00.000Z",
          "key": 1727650320000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:53:00.000Z",
          "key": 1727650380000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16
          },
          "unweightedAvg_of_temperature": {
            "value": 16.434895833333332
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.958705357142858
          },
          "ewma_of_temperature": {
            "value": 16.764296875
          },
          "holt_of_temperature": {
            "value": 16.7598671875
          }
        },
        {
          "key_as_string": "2024-09-29T22:54:00.000Z",
          "key": 1727650440000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 15.901041666666666
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.470982142857142
          },
          "ewma_of_temperature": {
            "value": 16.258750000000003
          },
          "holt_of_temperature": {
            "value": 16.255093750000004
          }
        },
        {
          "key_as_string": "2024-09-29T22:55:00.000Z",
          "key": 1727650500000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 15.5
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.171875
          },
          "ewma_of_temperature": {
            "value": 15.857031250000002
          },
          "holt_of_temperature": {
            "value": 15.850703124999999
          }
        },
        {
          "key_as_string": "2024-09-29T22:56:00.000Z",
          "key": 1727650560000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.203125
          },
          "unweightedAvg_of_temperature": {
            "value": 15.234375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.044642857142858
          },
          "ewma_of_temperature": {
            "value": 15.279062500000002
          },
          "holt_of_temperature": {
            "value": 15.278218750000004
          }
        },
        {
          "key_as_string": "2024-09-29T22:57:00.000Z",
          "key": 1727650620000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T22:58:00.000Z",
          "key": 1727650680000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 15.234375
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.071428571428571
          },
          "ewma_of_temperature": {
            "value": 15.2125
          },
          "holt_of_temperature": {
            "value": 15.2125
          }
        },
        {
          "key_as_string": "2024-09-29T22:59:00.000Z",
          "key": 1727650740000,
          "doc_count": 1,
          "average_temperature": {
            "value": 15.6015625
          },
          "unweightedAvg_of_temperature": {
            "value": 15.3671875
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.228794642857142
          },
          "ewma_of_temperature": {
            "value": 15.25140625
          },
          "holt_of_temperature": {
            "value": 15.252250000000002
          }
        },
        {
          "key_as_string": "2024-09-29T23:00:00.000Z",
          "key": 1727650800000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T23:01:00.000Z",
          "key": 1727650860000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.296875
          },
          "unweightedAvg_of_temperature": {
            "value": 15.731770833333334
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.627232142857142
          },
          "ewma_of_temperature": {
            "value": 15.424296875
          },
          "holt_of_temperature": {
            "value": 15.4270390625
          }
        },
        {
          "key_as_string": "2024-09-29T23:02:00.000Z",
          "key": 1727650920000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.59375
          },
          "unweightedAvg_of_temperature": {
            "value": 16.1640625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 13.996651785714286
          },
          "ewma_of_temperature": {
            "value": 15.763359375000002
          },
          "holt_of_temperature": {
            "value": 15.769617187500002
          }
        },
        {
          "key_as_string": "2024-09-29T23:03:00.000Z",
          "key": 1727650980000,
          "doc_count": 0,
          "average_temperature": {
            "value": null
          }
        },
        {
          "key_as_string": "2024-09-29T23:04:00.000Z",
          "key": 1727651040000,
          "doc_count": 1,
          "average_temperature": {
            "value": 16.796875
          },
          "unweightedAvg_of_temperature": {
            "value": 16.5625
          },
          "linearWeightedAvg_of_temperature": {
            "value": 14.267857142857142
          },
          "ewma_of_temperature": {
            "value": 16.37359375
          },
          "holt_of_temperature": {
            "value": 16.376265625000002
          }
        }
      ]
    }
  }
}

Steps to Reproduce

Run a query using linearWeightedAvg, observe the returned value is out of band.

Logs (if relevant)

No response

@garethhumphriesgkc garethhumphriesgkc added >bug needs:triage Requires assignment of a team area label labels Sep 29, 2024
@MohamedYassineBenomar
Copy link

I'm here to help with this issue! 👍

4 similar comments
@MohamedYassineBenomar

This comment has been minimized.

@MohamedYassineBenomar

This comment has been minimized.

@MohamedYassineBenomar

This comment has been minimized.

@MohamedYassineBenomar

This comment has been minimized.

@garethhumphriesgkc
Copy link
Author

If only there was someone here who could help with this issue!

@benwtrent benwtrent added the :Analytics/Aggregations Aggregations label Oct 2, 2024
@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) and removed needs:triage Requires assignment of a team area label labels Oct 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

4 participants