Aggregate API
Aggregating the search results are catered through Aggregate API
Our Aggregation API provides high-level calculations on top of our Search API.
Using Aggregations, you can power dashboard and run high-level analysis on the results of your searches. Aggregations use the same Lucene-based logic as the search API, and results are returned as ordinary JSON documents.
Endpoint Details
Endpoint | Type | Description | Example Use Cases |
---|---|---|---|
[/api/aggregate/term](https://api.platform.datastreamer.io/api/aggregate/term) | `POST` |
Term Aggregate endpoint enables the user to query for an aggregated view of the results, based on the provided parameters.
|
No query wrapping required.
Unlike a request to the Search API, request to the Aggregation endpoints do not require the query to be wrapped in a query object.
Term Aggregate
Endpoint:https://api.platform.datastreamer.io/api/aggregate/term
Here are a couple of important points that need to be considered before consuming the Term Aggregate endpoint.
- You can only perform an aggregation on the most recent 30 days, and timeframes within 30 days can be narrowed using date range filtering.
- Query uses all the possible Terms, Phases, and Modifiers as briefed under the Query section.
- Field can be set to any of the following.
Field | Date Filter Applicable |
---|---|
author.name | Yes |
author.bio | Yes |
author.gender | Yes |
author.handle | Yes |
enrichment.sentiment | Yes |
enrichment.language | Yes |
twitter.content.type | Yes |
twitter.content.subtype | Yes |
content.hashtags | Yes |
content.body | Yes |
Date Histogram Aggregate
Endpoint:https://api.platform.datastreamer.io/api/aggregate/date_histogram
What is a Histogram?
A histogram is an approximate representation of the distribution of numerical data.
Here are a couple of important points that need to be considered before consuming the Date Histogram endpoint.
- You can only perform an aggregation on the most recent 30 days, and timeframes within 30 days can be narrowed using date range filtering.
- The query within a Date Histogram can use all the possible Terms, Phases and Modifiers as briefed under Query, Metadata fields, and Enrichment sections.
- Data automatically adapts in resolution to the timeframes being requested. Therefore, a request for 10-minute segment will provide closer to per minute, while a week would provide daily. Searching 30 days will segment into 3 day buckets.
This is an approximation as, the API automatically calculates a date interval that will not exceed 10 buckets.
Updated 9 days ago