Skip to content

Top hits metric aggregation returning malformed responses #68904

@nreese

Description

@nreese

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
        },

Metadata

Metadata

Assignees

Labels

Team:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//bugFixes for quality problems that affect the customer experienceregressiontriage_needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions