Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Aggregations can be requested when querying items. They are used to calculate summarized views and statistics about the data in a search results. This allows you to build data drill-downs along the structured part of items as well as visualizations over time or other data dimensions.

Table of Contents

Table of Contents
outlinetrue
excludeTable of Contents

Specification

Request format

The request format is an url encoded JSON object of the following format:

...

 

Code Block
languagejs
"language": {
    "aggregate": {"fields": "provider"}
}

Group by date

The histogram aggregation method is recommended for dates, because it groups values by hour, day, week, etc.

To count the results for \item's creation dates, use the following aggregation:

Code Block
languagejs
"$item_created_at": {
    "method": "histogram"
}

This can again be nested, to for example aggregate the languages of items over time:

Code Block
languagejs
"$item_created_at": {
    "method": "histogram",
    "aggregation": {
       "fields": ["language"],
    }
}