Created
March 3, 2017 08:54
-
-
Save codefromthecrypt/7180c278b62e8f6a216a2aea45d08fc9 to your computer and use it in GitHub Desktop.
aggregation for binary annotations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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