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

EndpointTypeDescriptionExample Use Cases
Term AggregatePOSTTerm Aggregate endpoint enables the user to query for an aggregated view of the results, based on the provided parameters.

This retrieves the significant counts for the desired field of the results against the query. Mostly used to generate dashboards, reports, and graphs.
- Searching for which organizations have more results for "fraud" than usual.
- Seeing a significant result around the sentiment of a person.
- Suggesting keywords, hashtags, and influencers around a new company product.
- Suggesting Corona, SARS-CoV2, and Covid when searching for COVID-19.
Date Histogram AggregatePOSTDate Histogram Aggregate endpoint enables user to query the aggregated result based on a timeframe. Mostly used to generate dashboards, reports, and graphs.- Seeing patterns of sentiment towards company products over a time period.
- Identifying market impacts from different world events.
- Viewing the impact of marketing campaigns by viewing increases in organic chatter.

🚧

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: http://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.
FieldDate Filter Applicable
author.nameYes
author.bioYes
author.genderYes
author.handleYes
enrichment.sentimentYes
enrichment.languageYes
twitter.content.typeYes
twitter.content.subtypeYes
content.hashtagsYes
content.bodyYes

Date Histogram Aggregate

Endpoint: http://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.