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

Cannot read property 'orderBucketsBySum' of undefined #9458

Closed
ycombinator opened this issue Dec 13, 2016 · 1 comment
Closed

Cannot read property 'orderBucketsBySum' of undefined #9458

ycombinator opened this issue Dec 13, 2016 · 1 comment
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v5.1.2

Comments

@ycombinator
Copy link
Contributor

ycombinator commented Dec 13, 2016

Based on https://discuss.elastic.co/t/kibana-fails-to-show-future-date-on-line-chart/68806:

Kibana version: 5.1.1

Description of the problem including expected versus actual behavior:

User tried to create a line chart with a date histogram (x-axis) and 3 avg series (y-axis). They got an empty chart:

empty chart

And this error (presumably in the browser's dev console):

commons.bundle.js:38 TypeError: 
Cannot read property 'orderBucketsBySum' of undefined

    at Data.value (http://somehost:5601/bundles/kibana.bundle.js?v=14566:44:31056)
    at http://somehost:5601/bundles/kibana.bundle.js?v=14566:44:31664
    at Array.forEach (native)
    at Data.value (http://somehost:5601/bundles/kibana.bundle.js?v=14566:44:31482)
    at new Data (http://somehost:5601/bundles/kibana.bundle.js?v=14566:44:24195)
    at getData (http://somehost:5601/bundles/kibana.bundle.js?v=14566:46:16670)
    at Object.line (http://somehost:5601/bundles/kibana.bundle.js?v=14566:46:16818)
    at Vis.value (http://somehost:5601/bundles/kibana.bundle.js?v=14566:54:25848)
    at Function.uiState._uiStateChangeHandler (http://somehost:5601/bundles/kibana.bundle.js?v=14566:54:25729)
    at http://somehost:5601/bundles/commons.bundle.js?v=14566:55:663

This is the query being sent by Kibana to Elasticsearch:

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "*",
            "analyze_wildcard": true
          }
        },
        {
          "query_string": {
            "analyze_wildcard": true,
            "query": "*"
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": 1479005148266,
              "lte": 1481597148266,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "must_not": []
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "ReportWeek",
        "interval": "1w",
        "time_zone": "Asia/Tokyo",
        "min_doc_count": 1
      },
      "aggs": {
        "1": {
          "avg": {
            "field": "AC"
          }
        },
        "3": {
          "avg": {
            "field": "EV"
          }
        },
        "4": {
          "avg": {
            "field": "PV"
          }
        }
      }
    }
  }
}

And this is the response from Elasticsearch:

{
  "took": 108,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 108,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "2": {
      "buckets": [
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 16250
          },
          "key_as_string": "2017/01/30 00:00:00",
          "key": 1485702000000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 41250
          },
          "key_as_string": "2017/02/06 00:00:00",
          "key": 1486306800000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 70000
          },
          "key_as_string": "2017/02/13 00:00:00",
          "key": 1486911600000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 98750
          },
          "key_as_string": "2017/02/20 00:00:00",
          "key": 1487516400000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 126250
          },
          "key_as_string": "2017/02/27 00:00:00",
          "key": 1488121200000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 167500
          },
          "key_as_string": "2017/03/06 00:00:00",
          "key": 1488726000000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 221250
          },
          "key_as_string": "2017/03/13 00:00:00",
          "key": 1489330800000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 275000
          },
          "key_as_string": "2017/03/20 00:00:00",
          "key": 1489935600000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 331250
          },
          "key_as_string": "2017/03/27 00:00:00",
          "key": 1490540400000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 337500
          },
          "key_as_string": "2017/04/03 00:00:00",
          "key": 1491145200000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 341250
          },
          "key_as_string": "2017/04/10 00:00:00",
          "key": 1491750000000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 385000
          },
          "key_as_string": "2017/04/17 00:00:00",
          "key": 1492354800000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 408750
          },
          "key_as_string": "2017/04/24 00:00:00",
          "key": 1492959600000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 462500
          },
          "key_as_string": "2017/05/01 00:00:00",
          "key": 1493564400000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 513750
          },
          "key_as_string": "2017/05/08 00:00:00",
          "key": 1494169200000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 522500
          },
          "key_as_string": "2017/05/15 00:00:00",
          "key": 1494774000000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 526250
          },
          "key_as_string": "2017/05/22 00:00:00",
          "key": 1495378800000,
          "doc_count": 6
        },
        {
          "1": {
            "value": 0
          },
          "3": {
            "value": 0
          },
          "4": {
            "value": 526250
          },
          "key_as_string": "2017/05/29 00:00:00",
          "key": 1495983600000,
          "doc_count": 6
        }
      ]
    }
  },
  "status": 200
}

Note that the user's time field is @timestamp but the x-axis date histogram is using a different field, ReportWeek. Further, the buckets for this field in the response have dates in the future (i.e. after the max date of the @timestamp time filter window).

The user thinks this was working in version 5.0.1.

@ycombinator ycombinator added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) bug Fixes for quality problems that affect the customer experience v5.1.1 P1 labels Dec 13, 2016
@ycombinator
Copy link
Contributor Author

ycombinator commented Dec 13, 2016

I was able to reproduce this locally as well using makelogs data. The error seems to be related to using a datetime field other than the configured time field for the index pattern in the x-axis bucketing aggregation.

Evidence:

dec-13-2016 06-06-37

Notice how there are no errors when I use the @timestamp field for the x-axis bucketing aggregation. This field is the time field for my index pattern. However, when I switch to a different field, utc_time, I get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v5.1.2
Projects
None yet
Development

No branches or pull requests

3 participants