问题
I was looking through the documentation for Algolia and could not find anything related to doing aggregations like you can in elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html
An example of what I want to do is this:
- When a user searches, I show in real time the results of an aggregation on that query as well, such as a count of everything matching a particular filter (e.g. count of all the red items, blue items, yellow items etc)
回答1:
What ES calls "aggregations" is actually a subset of the "facets" that Algolia provides (see https://www.algolia.com/doc/search/filtering-faceting#faceting). The Algolia faceting capabilities is what you can achieve in ES using the term
aggregation.
Faceting will compute the counts associated to each faceted value and provides you a way to filter on those values.
Since Algolia has been highly optimized and designed for as-you-type full-text search, the engine doesn't provide deep aggregation capabilities. The only aggregation you would get is the min
, max
, avg
values if the underlying facet values are numbers.
来源:https://stackoverflow.com/questions/36929609/statistics-aggregations-in-algolia