OpenSearch-Dashboards
OpenSearch-Dashboards copied to clipboard
[BUG] Visualising time series of average value of rolled up index displays error
Creating time series visualisation of rolled up index - specifically average value displays error. Following error is displayed:
The request for this panel failed Cannot invoke "Object.getClass()" because "receiver" is null sum += a[0]; ^---- HERE

Rolled up index is from metricbeat and rolled up index was created via dashboards gui.
Rollup jobs has aggreagation done on @timestamp and service-node.keyword (term). Aggregated metrics are:
- system.cpu.system.norm.pct
- system.cpu.user.norm.pct
all options are checked, ie min, max, sum, avg, value count
JSON payload generated by GUI to search indices is as follows:
{ "size": 0, "query": { "bool": { "must": [ { "range": { "@timestamp": { "gte": "2021-11-03T21:50:33.264Z", "lte": "2021-11-04T21:50:33.264Z", "format": "strict_date_optional_time" } } } ], "filter": [ { "match_all": {} } ], "should": [], "must_not": [] } }, "aggs": { "61ca57f1-469d-11e7-af02-69e470af7417": { "terms": { "field": "service-node.keyword", "order": { "_key": "desc" } }, "aggs": { "timeseries": { "date_histogram": { "field": "@timestamp", "min_doc_count": 0, "time_zone": "Europe/Prague", "extended_bounds": { "min": 1635976233264, "max": 1636062633264 }, "calendar_interval": "1m" }, "aggs": { "61ca57f2-469d-11e7-af02-69e470af7417": { "avg": { "field": "system.cpu.system.norm.pct" } } } } }, "meta": { "timeField": "@timestamp", "intervalString": "1m", "bucketSize": 60, "seriesId": "61ca57f1-469d-11e7-af02-69e470af7417" } } }, "timeout": "30000ms" }
opensearch response - json payload:
{ "error": { "root_cause": [], "type": "search_phase_execution_exception", "reason": "", "phase": "fetch", "grouped": true, "failed_shards": [], "caused_by": { "type": "script_exception", "reason": "runtime error", "script_stack": [ "sum += a[0]; ", "^---- HERE" ], "script": "double sum = 0; double count = 0; for (a in states) { sum += a[0]; count += a[1]; } return sum/count", "lang": "painless", "position": { "offset": 54, "start": 54, "end": 67 }, "caused_by": { "type": "null_pointer_exception", "reason": "Cannot invoke \"Object.getClass()\" because \"receiver\" is null" } } }, "status": 400 }
JSON of rollup job:
{ "_id": "rrrr", "_seqNo": 367661, "_primaryTerm": 1, "rollup": { "rollup_id": "rrrr", "enabled": false, "schedule": { "interval": { "start_time": 1636062376706, "period": 1, "unit": "Minutes" } }, "last_updated_time": 1636062376706, "enabled_time": null, "description": "", "schema_version": 11, "source_index": "rollup-testing-100*", "target_index": "rollup-testing-201", "metadata_id": "q3nr7HwB_CHlSCQynRlm", "page_size": 1000, "delay": 0, "continuous": false, "dimensions": [ { "date_histogram": { "fixed_interval": "1m", "source_field": "@timestamp", "target_field": "@timestamp", "timezone": "UTC" } }, { "terms": { "source_field": "service-node.keyword", "target_field": "service-node.keyword" } } ], "metrics": [ { "source_field": "system.cpu.system.norm.pct", "metrics": [ { "min": {} }, { "max": {} }, { "sum": {} }, { "avg": {} }, { "value_count": {} } ] }, { "source_field": "system.cpu.user.norm.pct", "metrics": [ { "min": {} }, { "max": {} }, { "sum": {} }, { "avg": {} }, { "value_count": {} } ] } ] }, "metadata": { "rrrr": { "metadata_id": "q3nr7HwB_CHlSCQynRlm", "rollup_metadata": { "rollup_id": "rrrr", "last_updated_time": 1636062440221, "status": "finished", "failure_reason": null, "stats": { "pages_processed": 10, "documents_processed": 1518881, "rollups_indexed": 8346, "index_time_in_millis": 809, "search_time_in_millis": 1958 } } } } }
To Reproduce Steps to reproduce the behavior:
- Create metricbeat index
- Populate index
- Create rollup job with aggregations based on @timestamp, custom field - term and aggreagate two metrics:
- system.cpu.system.norm.pct
- system.cpu.user.norm.pct
- Execute rollup job and create rolled up index.
- Create timeseries visualisation
- in panel options as index pattern write name of rolledup index
- in data as aggregation select average, field either system.cpu.system.norm.pct or system.cpu.user.norm.pct
- group by terms - select custom field used for rollup job creation in step 3
- set timeframe where index contains any data
- See error
Expected behavior Average values are displayed aggregated per custom field, as is working for, count, min, max etc
OpenSearch Version Opnesearch version 1.1.0
Dashboards Version 1.1.0
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- Linux
- Google chrome 94
