1. rules
1.1. define them in the same JSON request as queries
1.2. run on the results of your query
1.3. further filter down the results of the query
2. structure
2.1. Untitled
2.2. Untitled
3. aggregations run on query results
3.1. Untitled
4. filters and aggregations
4.1. post filter
4.1.1. post filter runs after the query and does not affect aggregations
4.1.2. Untitled
4.1.3. Untitled
4.2. filtered query
4.2.1. a filter wrapped in a filtered query runs first and restricts both results and aggregations
4.2.2. Untitled
4.2.3. Untitled
4.2.4. Untitled
5. categories
5.1. metric aggregations
5.1.1. metric aggregations and typical use cases
5.1.1.1. Untitled
5.1.2. get stats for the number of event attendees
5.1.2.1. build a script field
5.1.2.1.1. put a typically small piece of code that returns a value for each document
5.1.2.2. Untitled
5.1.3. only ask for one of those statistics
5.1.3.1. get the average number of event attendees
5.1.3.2. Untitled
5.1.4. extended_stats
5.1.4.1. query
5.1.4.1.1. Untitled
5.1.4.2. reply
5.1.4.2.1. Untitled
5.1.5. approximate statistics
5.1.5.1. percentiles
5.1.5.1.1. query
5.1.5.1.2. reply
5.1.5.2. cardinality
5.1.5.2.1. query
5.1.5.2.2. reply
5.2. multi-bucket aggregations
5.2.1. major types
5.2.1.1. Untitled
5.2.2. use cases
5.2.2.1. Untitled
5.2.3. terms aggregations
5.2.3.1. terms
5.2.3.1.1. def: frequency of each term in your documents
5.2.3.1.2. by default, order is by their count, descending
5.2.3.1.3. e.g. figuring out things like frequent posters on a blog or popular tags
5.2.3.2. significant terms
5.2.3.2.1. def: give back the difference between the occurrence of a term in the whole index and its occurrence in your query results
5.2.3.2.2. e.g. suggesting terms that are significant for the search context
5.2.3.3. result accuracy
5.2.3.3.1. scenario
5.2.3.3.2. improve by increasing shard_size
5.2.3.3.3. how accurate results are
5.2.4. range aggregations
5.2.4.1. manually define each range
5.2.5. histogram aggregations
5.2.5.1. define a fixed interval
5.2.6. nested, reverse nested and children aggregations
5.2.6.1. result grouping
5.2.6.1.1. Untitled
5.2.6.2. query
5.2.6.2.1. Untitled
5.2.6.3. reply
5.2.6.3.1. Untitled
5.2.6.3.2. Untitled
5.2.7. geo distance and geohash grid aggregations
5.3. single-bucket aggregations
5.3.1. global
5.3.1.1. Untitled
5.3.2. filter and filters aggregations
5.3.2.1. Untitled
5.3.3. missing