APM - Not showing Aggregation

Highlighting a search in the APM gives me this:

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

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
}

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"?

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.

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() 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!

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

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

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.

Indeed, it was dropping everything outside of the query. I've fixed that in 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. :slight_smile:

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

J/.

I can definitely take a look. :slight_smile: