Top-K Plot with nested aggregations

Dear experts,

I would like to create a Top-K Plot as shown here using this DSL query:

"aggs": {
  "nested_app": {
    "nested": {
      "path": "app"
    },
    "aggs": {
      "message" : {
        "filter": {
         "term": {
            "app.key": "contextMap.connectionname"
          }
        },
        "aggs": {
          "login_types": {
            "terms": {
              "field": "app.value_string.raw"
            }
          }
        }
      }
    }
  }
}

This is the result I get from Elasticsearch when I send the search request:

"aggregations" : {
  "nested_app" : {
    "doc_count" : 2054789105,
    "message" : {
      "doc_count" : 1022033,
      "login_types" : {
        "doc_count_error_upper_bound" : 823,
        "sum_other_doc_count" : 97623,
        "buckets" : [
          {
            "key" : "My Demo Application",
            "doc_count" : 307735
          }
        ]
      }
    }
  }
}

Can you please help me integrating the DSL query properly into the data, marks, and sales sections?

The diagram should show the key on the y-axis and the doc_count on the x-axis.

Thanks and br,
Elmar

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.