ElasticGraph Query API: Aggregation Grouping
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
When aggregating documents, the groupings are defined by groupedBy. Here’s an example:
Copied!
query ArtistCountsByYearFormedAndHomeCountry {
artistAggregations {
nodes {
groupedBy {
bio {
yearFormed
homeCountry
}
}
count
}
}
}
In this case, we’re grouping by multiple fields; a grouping will be returned for each
combination of Artist.bio.yearFormed and Artist.bio.homeCountry found in the data.
Date Grouping
Group dates by calendar intervals or day of week.
DateTime Grouping
Group timestamps by date, time, or day of week, with optional time zones and offsets.
Geographic Grouping
Group locations into Web Mercator XYZ tiles, with selectable centers, bounds, and corners.