Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Created February 17, 2023 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebuildy/055d163ec729d537fd8c34f3e9726cd0 to your computer and use it in GitHub Desktop.
Save ebuildy/055d163ec729d537fd8c34f3e9726cd0 to your computer and use it in GitHub Desktop.
elasticsearch APM get max duration percentiles for 10 minutes
POST apm-*-span/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "2023-02-16T13:00:00.540Z"
}
}
}
]
}
},
"aggs": {
"times": {
"date_histogram": {
"field": "@timestamp",
"interval": "10m"
},
"aggs": {
"duration": {
"percentiles": {
"field": "span.duration.us",
"percents": [
80
]
}
}
}
},
"max_duration": {
"max_bucket": {
"buckets_path": "times>duration[80]"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment