ElasticGraph Query API: Aggregation Counts
Try these example queries by visiting the GraphiQL UI after booting locally.
Copied!
$ curl -s https://block.github.io/elasticgraph/dc.yml | docker compose -f - up --pull always
The aggregations API allows you to count documents within a grouping:
Copied!
query ArtistCountsByCountry {
artistAggregations {
nodes {
groupedBy {
bio { homeCountry }
}
count
}
}
}
This query, for example, returns a grouping for each country, and provides a count of how many artists call each country home.