Description Usage Arguments Value Examples
Sometimes it is necessary to perform an aggregation on the results of a query (i.e. on a subset
of all the available documents). This is achieved by adding an aggs
object to a
query
object.
1 2 | ## S3 method for class 'elastic_api'
x + y
|
x |
|
y |
|
elastic_aggs
object that contains the query information required for the
aggregation.
1 2 3 4 5 6 7 8 9 | all_docs <- query('{"match_all": {}}')
avg_sepal_width_per_cat <- aggs('{"avg_sepal_width_per_cat": {
"terms": {"field": "species"},
"aggs": {"avg_sepal_width": {"avg": {"field": "sepal_width"}}}}
}')
all_docs + avg_sepal_width_per_cat
sort_by_sepal_width <- sort_on('[{"sepal_width": {"order": "asc"}}]')
all_docs + sort_by_sepal_width
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.