# APM - Not showing Aggregation

**URL:** <https://discuss.elastic.co/t/apm-not-showing-aggregation/250762>\
**Category:** APM\
**Tags:** python\
**Created:** [October 2, 2020, 8:47am UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762 "2020-10-02T08:47:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hogbinj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogbinj/32/14744_2.png) [@hogbinj](https://discuss.elastic.co/u/hogbinj)\
**Post date:** [October 2, 2020, 8:47am UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/1 "2020-10-02T08:47:32Z")

</div>

Highlighting a search in the APM gives me this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/0/20c049b123af5d3567e135475e9490d53bcb4a1a.png)

however the action is an aggregation as shown below. So where do I find the Aggregation details in the APM console?

```auto
GET IndexAlias*/_search
{"query": { 
  "bool": {
    "filter": [
      {
        "bool": {
          "must": [
            {
              "terms": {
                "FieldName": [
                  "field-value"
                ]
              }
            },
            {
              "terms": {
                "FieldName": [
                  "field-value"
                ]
              }
            },
            {
              "range": {
                "Field-Name": {
                  "gte": "now-1y",
                  "lte": "now"
                }
              }
            }
          ]
        }
      }
    ]
  }
  },
  "aggs": {
    "agg_type": {
      "terms": {
        "field": "Field-Name"
      },
      "aggs": {
        "agg_time": {
          "date_histogram": {
            "field": "Field-Name",
            "calendar_interval": "week"
          }
        }
      }
    }
  },
  "_source": false
}

```

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [October 2, 2020, 5:19pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/2 "2020-10-02T17:19:09Z")

</div>

> So where do I find the Aggregation details in the APM console?

I'm not certain what you're asking here. This span appears to be a call from the elasticsearch-py client. What do you mean by the "APM console"?

---

<div class="post-metadata">

**Author:** ![hogbinj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogbinj/32/14744_2.png) [@hogbinj](https://discuss.elastic.co/u/hogbinj)\
**Post date:** [October 5, 2020, 8:03am UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/3 "2020-10-05T08:03:21Z")

</div>

Console == The APM front end in Kibana.

The Span details shows me the Index/Alias and the ES Query but NOT the Aggregation

Which is pretty important info.

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [October 5, 2020, 3:18pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/4 "2020-10-05T15:18:42Z")

</div>

Oh, I see. Our `elasticsearch-py` instrumentation doesn't collect the result of queries -- we just collect information that would be used for diagnosing problems with a query (the query itself, timing information, errors). Collecting the actual data returned by the query isn't relevant to monitoring the performance of the query, so it's a bit out of our scope.

However, you could add this data to your transaction using [`elasticapm.set_custom_context()`](https://www.elastic.co/guide/en/apm/agent/python/current/api.html#api-set-custom-context) if you want to have the results in Elasticsearch. I don't think this custom context will be automatically shown in the APM tab of Kibana, but it should be present when you drill down into the transaction.

Hope that answers your question!

---

<div class="post-metadata">

**Author:** ![hogbinj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogbinj/32/14744_2.png) [@hogbinj](https://discuss.elastic.co/u/hogbinj)\
**Post date:** [October 5, 2020, 3:23pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/5 "2020-10-05T15:23:04Z")

</div>

I don't want the results. I get those in the front end.

The query as shown in the Span details is missing the following:

```
,
      "aggs": {
        "agg_time": {
          "date_histogram": {
            "field": "Field-Name",
            "calendar_interval": "week"
          }
        }
      }
    }
  }

```

In some Aggs queries all the Span shows is  
"MatchAll" : {}

which is pretty useless as to discovering what is going on

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [October 5, 2020, 3:24pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/6 "2020-10-05T15:24:06Z")

</div>

Ohhhh, I apologize for my misunderstanding. Let me do a little digging.

---

<div class="post-metadata">

**Author:** ![hogbinj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogbinj/32/14744_2.png) [@hogbinj](https://discuss.elastic.co/u/hogbinj)\
**Post date:** [October 5, 2020, 3:27pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/7 "2020-10-05T15:27:49Z")

</div>

Thank you. If it helps Sort is omitted as well

it seems to drop anything outside the actual Query{} even though the additional info is often critical to working out why things are taking so long.

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [October 5, 2020, 3:48pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/8 "2020-10-05T15:48:48Z")

</div>

Indeed, it was dropping everything outside of the query. I've fixed that in [https://github.com/elastic/apm-agent-python/pull/940](https://github.com/elastic/apm-agent-python/pull/940)

It will be included in our next release. Thank you for pointing this out, missing `aggs` and similar context information was a big problem! Sorry it took me awhile to properly understand the issue. 🙂

---

<div class="post-metadata">

**Author:** ![hogbinj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hogbinj/32/14744_2.png) [@hogbinj](https://discuss.elastic.co/u/hogbinj)\
**Post date:** [October 5, 2020, 3:51pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/9 "2020-10-05T15:51:57Z")

</div>

Thank you very much indeed.

That's great.

If I could be cheeky and ask you for any guidance you may have on [APM configuration for AWS](https://discuss.elastic.co/t/apm-configuration-for-aws/250773)

J/.

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [October 5, 2020, 3:55pm UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/10 "2020-10-05T15:55:32Z")

</div>

I can definitely take a look. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2020, 11:55am UTC](https://discuss.elastic.co/t/apm-not-showing-aggregation/250762/11 "2020-10-26T11:55:46Z")

</div>

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