Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codefromthecrypt/7180c278b62e8f6a216a2aea45d08fc9 to your computer and use it in GitHub Desktop.
Save codefromthecrypt/7180c278b62e8f6a216a2aea45d08fc9 to your computer and use it in GitHub Desktop.
aggregation for binary annotations
# this returns all of the annotation values, not just the http.url
# for more.. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html
curl -s 'localhost:9200/zipkin-*/span/_search' -d'{
"_source": false,
"aggs": {
"binaryAnnotations": {
"nested": {
"path": "binaryAnnotations"
},
"aggs" : {
"value": {
"terms": {
"field": "binaryAnnotations.value"
}
}
}
}
},
"query": {
"bool": {
"filter": {
"bool": {
"should": [
{
"nested": {
"path": "binaryAnnotations",
"query": {
"bool": {
"must": {
"term": {
"binaryAnnotations.key": "http.url"
}
}
}
}
}
},
{
"nested": {
"path": "binaryAnnotations",
"query": {
"bool": {
"must": {
"term": {
"binaryAnnotations.endpoint.serviceName": "brave-webmvc-example"
}
}
}
}
}
}
]
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment