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

Top hits metric aggregation returning malformed responses #68904

Closed
nreese opened this issue Jun 11, 2020 · 4 comments
Closed

Top hits metric aggregation returning malformed responses #68904

nreese opened this issue Jun 11, 2020 · 4 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience regression Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed

Comments

@nreese
Copy link
Contributor

nreese commented Jun 11, 2020

Steps to reproduce

  1. Install web logs sample data set
  2. create new pie chart visualization.
  3. split on field machine.os.keyword
  4. Configure metric aggregation to be top hits on bytes field.
  5. Apply changes
  6. Notice that no pie chart is displayed. No errors are given in console

Screen Shot 2020-06-11 at 9 05 14 AM

Opening inspector reveals some odd behavior. Notice in the request that top hit field is requested as docvalue_field with use_field_mapping. Then notice that the response is not a number but rather a string like use_field_mapping7616

Request

{
  "aggs": {
    "2": {
      "terms": {
        "field": "machine.os.keyword",
        "order": {
          "_key": "desc"
        },
        "size": 5
      },
      "aggs": {
        "1": {
          "top_hits": {
            "docvalue_fields": [
              {
                "field": "bytes",
                "format": "use_field_mapping"
              }
            ],
            "_source": "bytes",
            "size": 1,
            "sort": [
              {
                "timestamp": {
                  "order": "desc"
                }
              }
            ]
          }
        }
      }
    }
  },

Response

"aggregations": {
    "2": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "1": {
            "hits": {
              "total": 2,
              "max_score": null,
              "hits": [
                {
                  "_index": "kibana_sample_data_logs",
                  "_id": "m_GynnIBZY7Hk4-PIA1x",
                  "_score": null,
                  "_source": {
                    "bytes": 7616
                  },
                  "fields": {
                    "bytes": [
                      "use_field_mapping7616"
                    ]
                  },
                  "sort": [
                    1591887117359
                  ]
                }
              ]
            }
          },
          "key": "win xp",
          "doc_count": 2
        },
@nreese nreese added bug Fixes for quality problems that affect the customer experience regression triage_needed Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Jun 11, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@nreese
Copy link
Contributor Author

nreese commented Jun 12, 2020

seems related to #68883

@nreese
Copy link
Contributor Author

nreese commented Jun 12, 2020

cc @lukeelmers

@sulemanof
Copy link
Contributor

Fixed in #71168
Tested on master, works as expected:

image

@sulemanof sulemanof self-assigned this Sep 30, 2020
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 regression Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed
Projects
None yet
Development

No branches or pull requests

3 participants