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

Bar in a bar chart gets incorrect sorted order when adding a sub-bucket aggregation #18551

Closed
TomonoriSoejima opened this issue Apr 25, 2018 · 1 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)

Comments

@TomonoriSoejima
Copy link
Contributor

Kibana version:
6.2.2
Elasticsearch version:
6.2.2
Server OS version:
Mac OS
Browser version:
Version 66.0.3359.117 (Official Build) (64-bit)

Browser OS version:
Chrome 66 on Mac OS X 10

Original install method (e.g. download page, yum, from source, etc.):
Download page
Description of the problem including expected versus actual behavior:

Steps to reproduce:
problem

I created some data set that lists countries sorted in alphebetical order and within each bar there are 12 elemtents inside execpet the first bar Australia.

This is important to report the odd behavior.
Now what happens is nested aggregation on busy_month.keyword field is not respected.
What happens is the bar's fundation is devired from the botom elemenet found in the very first bar, which in htis case is JUNE.

This problem can be similar to #17532

Request

{
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "terms": {
        "field": "country.keyword",
        "size": 5,
        "order": {
          "_count": "asc"
        }
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "busy_month.keyword",
            "size": 12,
            "order": {
              "_count": "desc"
            }
          }
        }
      }
    }
  },
  "stored_fields": [
    "*"
  ],
  "script_fields": {},
  "docvalue_fields": [
    "created"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        },
        {
          "range": {
            "created": {
              "gte": 1522508400000,
              "lte": 1525100399999,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "filter": [],
      "should": [],
      "must_not": []
    }
  }
}

Response

{
  "took": 8,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 5000,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "2": {
      "doc_count_error_upper_bound": -1,
      "sum_other_doc_count": 4451,
      "buckets": [
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "JUNE",
                "doc_count": 79
              }
            ]
          },
          "key": "Australia",
          "doc_count": 79
        },
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "FEBRUARY",
                "doc_count": 12
              },
              {
                "key": "MARCH",
                "doc_count": 11
              },
              {
                "key": "JUNE",
                "doc_count": 10
              },
              {
                "key": "DECEMBER",
                "doc_count": 8
              },
              {
                "key": "JANUARY",
                "doc_count": 8
              },
              {
                "key": "JULY",
                "doc_count": 8
              },
              {
                "key": "NOVEMBER",
                "doc_count": 8
              },
              {
                "key": "AUGUST",
                "doc_count": 6
              },
              {
                "key": "OCTOBER",
                "doc_count": 6
              },
              {
                "key": "APRIL",
                "doc_count": 5
              },
              {
                "key": "SEPTEMBER",
                "doc_count": 4
              },
              {
                "key": "MAY",
                "doc_count": 2
              }
            ]
          },
          "key": "US",
          "doc_count": 88
        },
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "APRIL",
                "doc_count": 14
              },
              {
                "key": "JULY",
                "doc_count": 13
              },
              {
                "key": "DECEMBER",
                "doc_count": 11
              },
              {
                "key": "JUNE",
                "doc_count": 11
              },
              {
                "key": "MAY",
                "doc_count": 11
              },
              {
                "key": "NOVEMBER",
                "doc_count": 10
              },
              {
                "key": "OCTOBER",
                "doc_count": 10
              },
              {
                "key": "MARCH",
                "doc_count": 9
              },
              {
                "key": "SEPTEMBER",
                "doc_count": 9
              },
              {
                "key": "FEBRUARY",
                "doc_count": 8
              },
              {
                "key": "JANUARY",
                "doc_count": 8
              },
              {
                "key": "AUGUST",
                "doc_count": 6
              }
            ]
          },
          "key": "KOREA",
          "doc_count": 120
        },
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "APRIL",
                "doc_count": 14
              },
              {
                "key": "AUGUST",
                "doc_count": 14
              },
              {
                "key": "JULY",
                "doc_count": 14
              },
              {
                "key": "SEPTEMBER",
                "doc_count": 14
              },
              {
                "key": "OCTOBER",
                "doc_count": 13
              },
              {
                "key": "MAY",
                "doc_count": 12
              },
              {
                "key": "JANUARY",
                "doc_count": 11
              },
              {
                "key": "MARCH",
                "doc_count": 9
              },
              {
                "key": "NOVEMBER",
                "doc_count": 8
              },
              {
                "key": "DECEMBER",
                "doc_count": 7
              },
              {
                "key": "FEBRUARY",
                "doc_count": 7
              },
              {
                "key": "JUNE",
                "doc_count": 5
              }
            ]
          },
          "key": "Vietnam",
          "doc_count": 128
        },
        {
          "3": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "JULY",
                "doc_count": 18
              },
              {
                "key": "DECEMBER",
                "doc_count": 16
              },
              {
                "key": "JANUARY",
                "doc_count": 16
              },
              {
                "key": "MARCH",
                "doc_count": 15
              },
              {
                "key": "APRIL",
                "doc_count": 14
              },
              {
                "key": "MAY",
                "doc_count": 10
              },
              {
                "key": "NOVEMBER",
                "doc_count": 9
              },
              {
                "key": "OCTOBER",
                "doc_count": 9
              },
              {
                "key": "SEPTEMBER",
                "doc_count": 9
              },
              {
                "key": "FEBRUARY",
                "doc_count": 8
              },
              {
                "key": "AUGUST",
                "doc_count": 5
              },
              {
                "key": "JUNE",
                "doc_count": 5
              }
            ]
          },
          "key": "UK",
          "doc_count": 134
        }
      ]
    }
  },
  "status": 200
}
@TomonoriSoejima TomonoriSoejima added bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) labels Apr 25, 2018
@timroes
Copy link
Contributor

timroes commented Apr 25, 2018

Closing this as a duplicate of #17532

@timroes timroes closed this as completed Apr 25, 2018
@timroes timroes added bug Fixes for quality problems that affect the customer experience and removed bug Fixes for quality problems that affect the customer experience labels Apr 25, 2018
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)
Projects
None yet
Development

No branches or pull requests

2 participants