Source: https://shakti.eventregistry.org/documentation?tab=searchEvents

# Get events

Find events that match one or more search conditions.

The search conditions can be specifying by setting one or multiple search parameters, such as `keyword`, `conceptUri`, `sourceUri`, `categoryUri`, `dateStart`, etc. If you need to specify a complex query with nested conditions that use a combination of Boolean AND, OR and NOT operators, then best approach is to specify the `query` parameter. To remove some of the results matching the **positive** conditions, you can specify some **negative** conditions using `ignoreKeyword`, `ignoreSourceUri`, and other `ignore*` parameters. The results of the search can be the list of matching events (default) or one of the various aggregates (summaries) of the matching events. In case of the aggregates, for example, the returned data can contain the geographic locations, where the events matching criteria occured, date of the matching events, etc. Each search can return up to 50 events per call. If the query matches more than 50 events, you can retrieve them by using `eventsPage` parameter and setting it to value 2, 3, 4, etc to retrieve additional pages of results. Each call will count as one event action (regardless of the number of returned events).

**Endpoint:** GET | POST `https://eventregistry.org/api/v1/event/getEvents`

**Headers:** Content-Type: application/json

#### `Parameters`

#### `apiKey`

string (required)

Your API key

#### `resultType`

string | string[]

Define what kind of results you would like to get.

Available values: `events`, `uriWgtList`, `timeAggr`, `locAggr`, `locTimeAggr`, `sourceAggr`, `authorAggr`, `keywordAggr`, `conceptAggr`, `conceptGraph`, `categoryAggr`, `breakingEvents`, `sentimentAggr`, `dateMentionAggr`, `recentActivityEvents`

Default value: `events`

#### `eventsPage`

integer

Determines the page of the results to return (starting from 1). Relevant when `resultType = events`.

Default value: `1`

#### `eventsCount`

integer

Define how many events (up to 50) will be returned. Relevant when `resultType = events`.

Default value: `50`

#### `eventsSortBy`

string

Set how you would like to sort your results. `date` (by event date), `rel` (relevance to the query), `size` (number of articles in the event). Relevant when `resultType = events`.

Available values: `date`, `rel`, `size`

Default value: `date`

#### `eventsSortByAsc`

boolean

Should the results be ordered in ascending order or descending order (default) based on the sorting criteria. Relevant when `resultType = events`.

Default value: `false`

#### `forceMaxDataTimeWindow`

integer

If you want to make sure that you are making queries just on the last month of data (to ensure smallest use of tokens) and you don't want to specify the `dateStart` and `dateEnd` parameters, then you can specify the `forceMaxDataTimeWindow` parameter and set it to 31 or 7 (the only two valid values). It determines the maximum age of the returned content. Don't specify the parameter if you want to search also the data that is older than 7 or 31 days.

Available values: `7`, `31`

#### `Filters`

Click to see different parameters that you can specify in order to filter the events

#### `query`

object

Query object with one or more search conditions. The `query` object should match the [Advanced Query Language](https://github.com/EventRegistry/event-registry-python/wiki/Searching-for-events#advanced-query-language) format. If you specify the `query` parameter, then the query parameters specified directly (`keyword`, `conceptUri`, `sourceUri`, `categoryUri`, etc) will be ignored.

#### `keyword`

string | string[]

Find events in which news articles mention the specified keyword or a phrase. If you specify multiple `keyword` parameters, then only events with articles that mention all of them will be returned, unless you specify `keywordOper` parameter and set it to `or`. Use the `keywordSearchMode` parameter to control how the keyword is matched; see the [keyword search modes](/documentation?tab=keyword_search_options) section.

Default value: `Barack Obama`

#### `conceptUri`

string | string[]

Find events for which the concept with concept uri is important. You can specify up to 50 concepts in a single search. If multiple `conceptUri` parameters are provided, then only events that are about all specified concepts will be returned, unless you specify `conceptOper` parameter and set it to `or`. Check [autosuggest methods](/documentation?tab=suggConcepts) to get concept URI value for a specified concept label.

Default value: `http://en.wikipedia.org/wiki/World_Health_Organization`

#### `categoryUri`

string | string[]

Find events that are about a particular category. You can specify up to 20 categories in a single search. If multiple `categoryUri` parameters are provided, then events that are about any of the specified categories will be returned, unless you specify `categoryOper` parameter and set it to `and`. Check [autosuggest methods](/documentation?tab=suggCategories) to get value for a specified category name.

Default value: `dmoz/Business/Accounting`

#### `sourceUri`

string | string[]

Find events that contain one or more articles that have been written by a specific news source. Check [autosuggest methods](/documentation?tab=suggSources) to get value for a source name.

Default value: `bbc.co.uk`

#### `sourceLocationUri`

string | string[]

Find events that contain one or more articles by news sources located at the given geographic location (city or a country). Check [autosuggest methods](/documentation?tab=suggLocations) to get value for a location name.

Default value: `http://en.wikipedia.org/wiki/Germany`

#### `sourceGroupUri`

string | string[]

Find events that contain one or more articles by news sources that are assigned to the predefined group of news sources.

Default value: `general/ERtop10`

#### `authorUri`

string | string[]

Find events that contain articles that were written by a particular author. Check [autosuggest methods](/documentation?tab=suggAuthors) to get value for author uri based on the author name (and potentially source url).

Default value: `mark_mazzetti@nytimes.com`

#### `locationUri`

string | string[]

Find events that occurred at a particular geographic location. Check [autosuggest methods](/documentation?tab=suggLocations) to get URI value for a given location name.

Example value: `http://en.wikipedia.org/wiki/United_States`

#### `lang`

string | string[]

Find events that contain articles in the specified language(s). You can specify at most 5 languages in a single search. Specify languages using their ISO3 language codes. The full list of languages and their ISO3 codes can be found on [this page](https://github.com/EventRegistry/event-registry-python/wiki/Supported-languages).

Example value: `eng`

#### `dateStart`

string

Limit the events to those that occured on or after this date. The date of the event is extracted from the news articles about the event and are potentially quite different than the dates when the articles about the event were published. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-03`

#### `dateEnd`

string

Limit the events to those that occured before or on this date. The date of the event is extracted from the news articles about the event and are potentially quite different than the dates when the articles about the event were published. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-10`

#### `minSentimentEvent`

integer

The minimum value of the sentiment, the event should have. Valid value is any floating number between -1 (very negative) to 1 (very positive). 0 represents neutral sentiment. Note that setting the value will automatically reduce results to events covered in English, since the sentiment can only be computed for English language.

#### `maxSentimentEvent`

integer

The maximum value of the sentiment, the event should have. Valid value is any floating number between -1 (very negative) to 1 (very positive). 0 represents neutral sentiment. Note that setting the value will automatically reduce results to events covered in English, since the sentiment can only be computed for English language.

#### `minArticlesInEvent`

integer

Find events that have been reported in at least `minArticlesInEvent` articles (regardless of language).

#### `maxArticlesInEvent`

integer

Find events that have not been reported in more than `maxArticlesInEvent` articles (regardless of language)

#### `reportingDateStart`

string

Limit the events to those for which the reporting date was on or after this date. The reporting date is computed by analyzing all the dates when the articles about an event were published and computing the average value. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-03`

#### `reportingDateEnd`

string

Limit the events to those for which the reporting date was before or on this date. The reporting date is computed by analyzing all the dates when the articles about an event were published and computing the average value. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-10`

#### `dateMentionStart`

string

Find events that contain one or more articles that explicitly mention a date that is equal or greater than `dateMentionStart`. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-10`

#### `dateMentionEnd`

string

Find events that contain one or more articles that explicitly mention a date that is lower or equal to `dateMentionEnd`. The date should be in the YYYY-MM-DD format.

Example value: `2018-01-10`

#### `keywordLoc`

string

What data should be used when searching using the keywords provided by `keywords` parameter.

Available values: `body`, `title`, `title,body`

Default value: `body`

#### `keywordOper`

string

If more keywords are provided with the `keyword` parameter, what should be the Boolean operator used. If `and` (default) then all of the specified keywords have to be present in the article about an event; if `or` then an event will be returned if it's articles mentions any of the provided keywords.

Available values: `and`, `or`

Default value: `and`

#### `keywordSearchMode`

string

Determines how the keywords provided with the `keyword` parameter are matched against the content. Use `phrase` (default) to match the keyword as an exact phrase, `exact` to use the Boolean query language (with `AND`, `OR`, `NOT`, `NEAR` and `NEXT` operators), or `simple` for a relevance-based search that does not require all terms to be present. See the [keyword search modes](/documentation?tab=keyword_search_options) section for details and examples.

Available values: `phrase`, `exact`, `simple`

Default value: `phrase`

#### `conceptOper`

string

If more concepts are provided with the `conceptUri` parameter, what should be the Boolean operator used. If `and` (default) then all of the specified concepts have to be present in the event; if `or` then an event will be returned if it mentions any of the provided concepts.

Available values: `and`, `or`

Default value: `and`

#### `categoryOper`

string

If more categories are provided with the `categoryUri` parameter, what should be the Boolean operator used. If `and` then all of the specified categories have to be present in the event; if `or` then an event will be returned if it mentions any of the provided categories.

Available values: `and`, `or`

Default value: `or`

#### `ignoreKeyword`

string | string[]

Ignore events in which news articles mention the specified keyword or phrase. If you specify multiple `ignoreKeyword` parameters, then events with articles that mention any of these keywords will be ignored.

Example value: `Donald Trump`

#### `ignoreConceptUri`

string | string[]

Ignore events for which the concept with concept uri is important. You can specify up to 50 concepts in a single search. If you specify multiple `ignoreConceptUri` parameters, then events that mention any of them will be ignored. Check [autosuggest methods](/documentation?tab=suggConcepts) to get value for a specified concept label.

Example value: `http://en.wikipedia.org/wiki/World_Health_Organization`

#### `ignoreCategoryUri`

string | string[]

Ignore events that are about a particular category. You can specify up to 20 categories in a single search. If you specify multiple `ignoreCategoryUri` parameters, then events that mention any of them will be ignored. Check [autosuggest methods](/documentation?tab=suggCategories) to get value for a specified category name.

Example value: `dmoz/Business/Accounting`

#### `ignoreSourceUri`

string | string[]

Ignore events that contain one or more articles that have been written by a news source. Check [autosuggest methods](/documentation?tab=suggSources) to get value for a source name.

Example value: `bbc.co.uk`

#### `ignoreSourceLocationUri`

string | string[]

Ignore events that contain one or more articles by news sources located at the given geographic location (city or a country). Check [autosuggest methods](/documentation?tab=suggLocations) to get value for a location name.

Example value: `bbc.co.uk`

#### `ignoreSourceGroupUri`

string | string[]

Ignore events that contain one or more articles by news sources that are assigned to the specified group of news sources.

Example value: `general/ERtop10`

#### `ignoreAuthorUri`

string | string[]

Ignore events that contain articles, which were written by a particular author. Check [autosuggest methods](/documentation?tab=suggAuthors) to get value for author uri based on the author name (and potentially source url).

Example value: `mark_mazzetti@nytimes.com`

#### `ignoreLocationUri`

string | string[]

Ignore events that occurred at a particular geographic location. Check [autosuggest methods](/documentation?tab=suggLocations) to get URI value for a given location name.

Example value: `http://en.wikipedia.org/wiki/United_States`

#### `ignoreLang`

string | string[]

Ignore events that contain articles in the specified language(s). You can specify at most 5 languages in a single search. Specify languages using their ISO3 language codes. The full list of languages and their ISO3 codes can be found on [this page](https://github.com/EventRegistry/event-registry-python/wiki/Supported-languages).

Example value: `deu`

#### `ignoreKeywordLoc`

string

What data should be used when searching using the keywords provided by `ignoreKeywords` parameter.

Available values: `body`, `title`, `title,body`

#### `Returned Details`

The API call can return more or less meta-data information about the events, articles, concepts, categories, sources and locations. Click to see the available properties that can be specified to determine the amount of returned information.

#### `includeEventTitle`

boolean

Set this parameter to true to include the event title in the response.

Default value: `true`

#### `includeEventSummary`

boolean

Set this parameter to true to include the event title in the response.

Default value: `false`

#### `includeEventSocialScore`

boolean

Set this parameter to true to include the event social score in the response.

Default value: `false`

#### `includeEventSentiment`

boolean

Set this parameter to true to include the event sentiment in the response.

Default value: `true`

#### `includeEventLocation`

boolean

Set this parameter to true to include the event location in the response.

Default value: `true`

#### `includeEventDate`

boolean

Set this parameter to true to include the event date in the response.

Default value: `true`

#### `includeEventArticleCounts`

boolean

Set this parameter to true to include the article counts for events in the response.

Default value: `true`

#### `includeEventConcepts`

boolean

Set this parameter to true to include the event concepts in the response.

Default value: `true`

#### `includeEventCategories`

boolean

Set this parameter to true to include the event categories in the response.

Default value: `true`

#### `includeEventCommonDates`

boolean

Set this parameter to true to include the event commmon dates in the response.

Default value: `false`

#### `includeEventStories`

boolean

Set this parameter to true to include the event stories in the response.

Default value: `false`

#### `eventImageCount`

integer

Define how many images you would like to have in the response.

Default value: `0`

#### `includeConceptLabel`

boolean

Set this parameter to true to include the concept label in the response.

Default value: `true`

#### `includeConceptImage`

boolean

Set this parameter to true to include the concept image in the response.

Default value: `false`

#### `includeConceptSynonyms`

boolean

Set this parameter to true to include the concept synonyms in the response.

Default value: `false`

#### `conceptLang`

string

Define the language of the concept label.

Default value: `eng`

#### `includeStoryBasicStats`

boolean

Set this parameter to true to include story basic stats in the response.

Default value: `false`

#### `includeStoryTitle`

boolean

Set this parameter to true to include the story title in the response.

Default value: `false`

#### `includeStoryLocation`

boolean

Set this parameter to true to include the story location in the response.

Default value: `false`

#### `includeStoryDate`

boolean

Set this parameter to true to include the story date in the response.

Default value: `false`

#### `includeStoryConcepts`

boolean

Set this parameter to true to include the story concepts in the response.

Default value: `false`

#### `includeStoryCategories`

boolean

Set this parameter to true to include the story categories in the response.

Default value: `false`

#### `includeStoryMedoidArticle`

boolean

Set this parameter to true to include story medoid article in the response.

Default value: `false`

#### `includeStoryCommonDates`

boolean

Set this parameter to true to include story common dates in the response.

Default value: `false`

#### `storyImageCount`

integer

Define how many images you would like to have in the response.

Default value: `0`

#### `includeCategoryParentUri`

boolean

Set this parameter to true to include category parent uri in the response.

Default value: `false`

#### `includeLocationPopulation`

boolean

Set to true to include the population size of the location.

Default value: `false`

#### `includeLocationGeoNamesId`

boolean

Set to true to include the GeoNames id of the location.

Default value: `false`

#### `includeLocationCountryArea`

boolean

Set to true to include the are of the location in squared km.

Default value: `false`

#### `includeLocationCountryContinent`

boolean

Set to true to get the continent of the country for location objects.

Default value: `false`

## Request examples

### Example 1

Search for events related to Barack Obama and sort them by relevance from most to least relevant.

Request body:

```json
{
  "resultType": "events",
  "conceptUri": "http://en.wikipedia.org/wiki/Barack_Obama",
  "eventsPage": 1,
  "eventsCount": 50,
  "eventsSortBy": "rel",
  "eventsSortByAsc": false,
  "eventsArticleBodyLen": -1,
  "apiKey": "YOUR_API_KEY",
  "forceMaxDataTimeWindow": 31
}
```

```python
from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY, allowUseOfArchive: false)

q = QueryEventsIter(conceptUri = "http://en.wikipedia.org/wiki/Barack_Obama")
for event in q.execQuery(er, sortBy = "rel", maxItems = 50):
    print(event)
```

```javascript
var er = new erBase.EventRegistry({allowUseOfArchive: false});
                    var query = new erBase.QueryEvents({conceptUri: "http://en.wikipedia.org/wiki/Barack_Obama"});
                    query.setRequestedResult(new RequestEventsInfo({count: 50, sortBy: "rel"}));
                    er.execQuery(query).then((response) => {
                        console.info(response);
                    });
```

```typescript
const er = new EventRegistry({allowUseOfArchive: false});
                    const query = new QueryEvents({conceptUri: "http://en.wikipedia.org/wiki/Barack_Obama"});
                    query.setRequestedResult(new RequestEventsInfo({count: 50, sortBy: "rel"}));
                    er.execQuery(query).then((response) => {
                        console.info(response);
                    });
```

### Example 2

Search for events reported by BBC News that were reported by at least 30 articles. Sort the results by date and return first 50 events.

Request body:

```json
{
  "resultType": "events",
  "sourceUri": "bbc.co.uk",
  "eventsPage": 1,
  "eventsCount": 50,
  "minArticlesInEvent": 30,
  "eventsSortBy": "date",
  "eventsSortByAsc": false,
  "apiKey": "YOUR_API_KEY",
  "forceMaxDataTimeWindow": 31
}
```

```python
from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)

bbcUri = er.getSourceUri("bbc")     # returns "bbc.com"

q = QueryEventsIter(sourceUri = bbcUri, minArticlesInEvent = 30)
for event in q.execQuery(er, sortBy = "date", maxItems = 50):
    print(event)
```

```javascript
var er = new erBase.EventRegistry({allowUseOfArchive: false});
var query = new erBase.QueryEvents({sourceUri: "bbc.co.uk", minArticlesInEvent: 30});
query.setRequestedResult(new RequestEventsInfo({count: 50, sortBy: "date"}));
er.execQuery(query).then((response) => {
    console.info(response);
});
```

```typescript
const er = new EventRegistry({allowUseOfArchive: false});
const query = new QueryEvents({sourceUri: "bbc.co.uk", minArticlesInEvent: 30});
query.setRequestedResult(new RequestEventsInfo({count: 50, sortBy: "date"}));
er.execQuery(query).then((response) => {
    console.info(response);
});
```

### Example 3

Find events that match a larger set of conditions provided using the `query` parameter. The conditions also include a negation part, where we want to exclude events that occurred on a particular day and events that are related to Barack Obama. Return top 50 events as sorted by relevance to the query.

Request body:

```json
{
  "query": {
    "$query": {
      "$or": [
        {
          "dateStart": "2017-02-05",
          "dateEnd": "2017-02-05"
        },
        {
          "conceptUri": "http://en.wikipedia.org/wiki/Donald_Trump"
        },
        {
          "categoryUri": "dmoz/Society/Politics"
        },
        {
          "$and": [
            {
              "conceptUri": "http://en.wikipedia.org/wiki/Angela_Merkel"
            },
            {
              "categoryUri": "dmoz/Business"
            }
          ]
        }
      ],
      "$not": {
        "$or": [
          {
            "dateStart": "2017-02-04",
            "dateEnd": "2017-02-04"
          },
          {
            "conceptUri": "http://en.wikipedia.org/wiki/Barack_Obama"
          }
        ]
      }
    }
  },
  "eventsPage": 1,
  "eventsCount": 50,
  "eventsSortBy": "rel",
  "eventsSortByAsc": false,
  "eventsArticleBodyLen": -1,
  "resultType": "events",
  "apiKey": "YOUR_API_KEY"
}
```

```python
from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)

qStr = """
{
    "$query": {
        "$or": [
            { "dateStart": "2017-02-05", "dateEnd": "2017-02-05" },
            { "conceptUri": "http://en.wikipedia.org/wiki/Donald_Trump" },
            { "categoryUri": "dmoz/Society/Politics" },
            {
                "$and": [
                    { "conceptUri": "http://en.wikipedia.org/wiki/Angela_Merkel" },
                    { "categoryUri": "dmoz/Business" }
                ]
            }
        ],
        "$not": {
            "$or": [
                { "dateStart": "2017-02-04", "dateEnd": "2017-02-04" },
                { "conceptUri": "http://en.wikipedia.org/wiki/Barack_Obama" }
            ]
        }
    }
}
"""
q = QueryEventsIter.initWithComplexQuery(qStr)
for event in q.execQuery(er, sortBy = "rel", maxItems = 50):
    print(event)
```

```javascript
var er = new erBase.EventRegistry();
                    var qStr = `
                    {
                        $query: {
                            $or: [
                                { "dateStart": "2017-02-05", dateEnd: "2017-02-05" },
                                { "conceptUri": "http://en.wikipedia.org/wiki/Donald_Trump" },
                                { categoryUri: "dmoz/Society/Politics" },
                                {
                                    $and: [
                                        { "conceptUri": "http://en.wikipedia.org/wiki/Angela_Merkel" },
                                        { "categoryUri": "dmoz/Business" }
                                    ]
                                }
                            ],
                            $not: {
                                $or: [
                                    { "dateStart": "2017-02-04", "dateEnd": "2017-02-04" },
                                    { "conceptUri": "http://en.wikipedia.org/wiki/Barack_Obama" }
                                ]
                            }
                        }
                    }
                    `;
                    var q1 = erBase.QueryEvents.initWithComplexQuery(qStr);
                    er.execQuery(q1).then((response) => {
                        console.info(response);
                    });
```

```typescript
const er = new EventRegistry();
                    const qStr = `
                    {
                        $query: {
                            $or: [
                                { "dateStart": "2017-02-05", dateEnd: "2017-02-05" },
                                { "conceptUri": "http://en.wikipedia.org/wiki/Donald_Trump" },
                                { categoryUri: "dmoz/Society/Politics" },
                                {
                                    $and: [
                                        { "conceptUri": "http://en.wikipedia.org/wiki/Angela_Merkel" },
                                        { "categoryUri": "dmoz/Business" }
                                    ]
                                }
                            ],
                            $not: {
                                $or: [
                                    { "dateStart": "2017-02-04", "dateEnd": "2017-02-04" },
                                    { "conceptUri": "http://en.wikipedia.org/wiki/Barack_Obama" }
                                ]
                            }
                        }
                    }
                    `;
                    const q1 = QueryEvents.initWithComplexQuery(qStr);
                    er.execQuery(q1).then((response) => {
                        console.info(response);
                    });
```

### Example 4

Find events mentioning "virus" and retrieve (a) top keywords from them, (b) number of events per day and (c) the list of categories associated with these events.

```python
from eventregistry import *
# since we want to analyze recent results, just prevent use of archive - in this way we don't need to set any date constraints
er = EventRegistry(apiKey = YOUR_API_KEY, allowUseOfArchive = False)

virusUri = er.getConceptUri("virus")
q = QueryEvents(conceptUri=virusUri, lang="eng")

# ask for the top keywords related to articles that mention virus
q.setRequestedResult(RequestEventKeywordAggr())
res = er.execQuery(q)
for kw in res.get("keywordAggr", {}).get("results", []):
    print(kw["keyword"])

# how many articles were published per day mentioning virus?
q.setRequestedResult(RequestEventsTimeAggr())
res = er.execQuery(q)
for kw in res.get("timeAggr", {}).get("results", []):
    print(kw["date"] + ": " + str(kw["count"]))


q.setRequestedResult(RequestEventsCategoryAggr())
res = er.execQuery(q)
for kw in res.get("categoryAggr", {}).get("results", []):
    print(kw["label"] + ": " + str(kw["count"]))
```

```javascript
var er = new erBase.EventRegistry();
                    er.getConceptUri("virus").then((virusUri) => {
                        var q = new erBase.QueryEvents({conceptUri: virusUri, lang: "eng"});
                        q.setRequestedResult(new erBase.RequestEventKeywordAggr());
                        er.execQuery(q).then((response) => {
                            console.log(response.keywordAggr.results);
                            q.setRequestedResult(new erBase.RequestEventsTimeAggr());
                            return er.execQuery(q);
                        }).then((response) => {
                            console.log(response.timeAggr.results);
                            q.setRequestedResult(new erBase.RequestEventsCategoryAggr());
                            return er.execQuery(q);
                        }).then((response) => {
                            console.log(response.categoryAggr.results);
                        });
                    });
```

```typescript
const er = new EventRegistry();
                    er.getConceptUri("virus").then((virusUri) => {
                        const q = new QueryArticles({conceptUri: virusUri});
                        q.setRequestedResult(new RequestEventKeywordAggr());
                        er.execQuery(q).then((response) => {
                            console.log(response.keywordAggr.results);
                            q.setRequestedResult(new RequestEventsTimeAggr());
                            return er.execQuery(q);
                        }).then((response) => {
                            console.log(response.timeAggr.results);
                            q.setRequestedResult(new RequestEventsCategoryAggr());
                            return er.execQuery(q);
                        }).then((response) => {
                            console.log(response.categoryAggr.results);
                        });
                    });
```

## Example output

```json
{
  "events": {
    "results": [
      {
        "uri": "eng-8625782",
        "concepts": [
          {
            "uri": "http://en.wikipedia.org/wiki/Tesla,_Inc.",
            "type": "org",
            "score": 100,
            "label": {
              "eng": "Tesla, Inc."
            }
          },
          {
            "uri": "http://en.wikipedia.org/wiki/Electrochemical_cell",
            "type": "wiki",
            "score": 83,
            "label": {
              "eng": "Electrochemical cell"
            }
          },
          {
            "uri": "http://en.wikipedia.org/wiki/Shanghai",
            "type": "loc",
            "score": 74,
            "label": {
              "eng": "Shanghai"
            },
            "location": {
              "type": "place",
              "label": {
                "eng": "Shanghai"
              },
              "country": {
                "type": "country",
                "label": {
                  "eng": "China"
                }
              }
            }
          },
          {
            "META": "other concepts..."
          }
        ],
        "eventDate": "2023-05-16",
        "totalArticleCount": 6,
        "title": {
          "eng": "Tesla applies to expand Shanghai plant, add pouch battery cell output"
        },
        "summary": {
          "eng": "(Reuters) - Tesla (NASDAQ: TSLA ) Inc has applied for regulatory clearance to expand its Shanghai plant and to begin producing for the first time pouch-type battery cells, albeit in small numbers.\n\nAn undated public notice said the potential expansion would give the Shanghai Gigafactory the capacity to produce 1.75 million powertrain units annually, up from 1.25 million currently.\n\nIt was not clear from the notice, posted on the website of the district where the factory is located, whether Tesla "
        },
        "infoArticle": {
          "eng": {
            "uri": "7546618078",
            "lang": "eng",
            "isDuplicate": false,
            "date": "2023-05-16",
            "time": "08:29:00",
            "dateTime": "2023-05-16T08:29:00Z",
            "dateTimePub": "2023-05-16T08:22:00Z",
            "dataType": "news",
            "sim": 0.9450980424880981,
            "url": "https://za.investing.com/news/tesla-applies-to-expand-shanghai-plant-add-pouch-battery-cell-output-2766295",
            "source": {
              "uri": "za.investing.com",
              "dataType": "news",
              "title": "Investing.com South Africa"
            }
          }
        },
        "location": {
          "type": "place",
          "label": {
            "eng": "Shanghai"
          },
          "country": {
            "type": "country",
            "label": {
              "eng": "China"
            }
          }
        },
        "categories": [
          {
            "uri": "dmoz/Science/Biology/Cryobiology",
            "label": "dmoz/Science/Biology/Cryobiology",
            "wgt": 100
          },
          {
            "uri": "dmoz/Science/Biology/Cell_Biology",
            "label": "dmoz/Science/Biology/Cell Biology",
            "wgt": 100
          },
          {
            "uri": "dmoz/Business/Energy/Fuel_Cells",
            "label": "dmoz/Business/Energy/Fuel Cells",
            "wgt": 100
          },
          {
            "uri": "news/Business",
            "label": "news/Business",
            "wgt": 56
          }
        ],
        "images": [
          "https://i-invdn-com.investing.com/news/https://i-invdn-com.investing.com/akapi-images/800x450/f63a488c70de29ce8dec307c117aea22_w_800_h_450.jpg"
        ],
        "articleCounts": {
          "eng": 6
        },
        "socialScore": 0,
        "sentiment": 0.05882352941176472,
        "wgt": 421891200,
        "relevance": 100
      },
      {
        "#META ITEM": "other events..."
      }
    ],
    "totalResults": 903,
    "page": 1,
    "count": 50,
    "pages": 19
  }
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "events": {
      "type": "object",
      "properties": {
        "totalResults": {
          "type": "integer"
        },
        "page": {
          "type": "integer"
        },
        "count": {
          "type": "integer"
        },
        "pages": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "uri": {
                "type": "string"
              },
              "concepts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "uri": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "score": {
                      "type": "integer"
                    },
                    "label": {
                      "type": "object",
                      "properties": {
                        "eng": {
                          "type": "string"
                        }
                      }
                    },
                    "image": {
                      "type": "string"
                    },
                    "synonyms": {
                      "type": "object",
                      "properties": {}
                    },
                    "trendingScore": {
                      "type": "object",
                      "properties": {
                        "news": {
                          "type": "object",
                          "properties": {
                            "score": {
                              "type": "double"
                            },
                            "testPopFq": {
                              "type": "integer"
                            },
                            "nullPopFq": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "label": {
                          "type": "object",
                          "properties": {
                            "eng": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "stories": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "uri": {
                      "type": "string"
                    },
                    "articleCount": {
                      "type": "integer"
                    },
                    "lang": {
                      "type": "string"
                    },
                    "avgCos": {
                      "type": "double"
                    },
                    "variance": {
                      "type": "double"
                    },
                    "title": {
                      "type": "string"
                    },
                    "isUserSetTitle": {
                      "type": "boolean"
                    },
                    "concepts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "uri": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "score": {
                            "type": "integer"
                          },
                          "label": {
                            "type": "object",
                            "properties": {
                              "eng": {
                                "type": "string"
                              }
                            }
                          },
                          "image": {
                            "type": "string"
                          },
                          "synonyms": {
                            "type": "object",
                            "properties": {}
                          },
                          "trendingScore": {
                            "type": "object",
                            "properties": {
                              "news": {
                                "type": "object",
                                "properties": {
                                  "score": {
                                    "type": "double"
                                  },
                                  "testPopFq": {
                                    "type": "integer"
                                  },
                                  "nullPopFq": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          },
                          "location": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "label": {
                                "type": "object",
                                "properties": {
                                  "eng": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "location": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "label": {
                            "type": "object",
                            "properties": {
                              "eng": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "isUserSetLocation": {
                      "type": "boolean"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "uri": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "wgt": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "medoidArticle": {
                      "type": "object",
                      "properties": {
                        "uri": {
                          "type": "string"
                        },
                        "lang": {
                          "type": "string"
                        },
                        "isDuplicate": {
                          "type": "boolean"
                        },
                        "date": {
                          "type": "string"
                        },
                        "time": {
                          "type": "string"
                        },
                        "dateTime": {
                          "type": "string"
                        },
                        "sim": {
                          "type": "double"
                        },
                        "url": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "body": {
                          "type": "string"
                        },
                        "source": {
                          "type": "object",
                          "properties": {
                            "uri": {
                              "type": "string"
                            },
                            "dataType": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "description": {
                              "type": "string"
                            },
                            "location": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "object",
                                  "properties": {
                                    "eng": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            },
                            "locationValidated": {
                              "type": "boolean"
                            },
                            "ranking": {
                              "type": "object",
                              "properties": {
                                "importanceRank": {
                                  "type": "integer"
                                }
                              }
                            }
                          }
                        },
                        "concepts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "uri": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "score": {
                                "type": "integer"
                              },
                              "label": {
                                "type": "object",
                                "properties": {
                                  "eng": {
                                    "type": "string"
                                  }
                                }
                              },
                              "image": {
                                "type": "string"
                              },
                              "synonyms": {
                                "type": "object",
                                "properties": {}
                              },
                              "trendingScore": {
                                "type": "object",
                                "properties": {
                                  "news": {
                                    "type": "object",
                                    "properties": {
                                      "score": {
                                        "type": "double"
                                      },
                                      "testPopFq": {
                                        "type": "integer"
                                      },
                                      "nullPopFq": {
                                        "type": "integer"
                                      }
                                    }
                                  }
                                }
                              },
                              "location": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "object",
                                    "properties": {
                                      "eng": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "uri": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "wgt": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "links": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "videos": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "image": {
                          "type": "string"
                        },
                        "duplicateList": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "originalArticle": {
                          "type": "string"
                        },
                        "eventUri": {
                          "type": "string"
                        },
                        "location": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string"
                            },
                            "label": {
                              "type": "object",
                              "properties": {
                                "eng": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        },
                        "extractedDates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "amb": {
                                "type": "boolean"
                              },
                              "imp": {
                                "type": "boolean"
                              },
                              "date": {
                                "type": "string"
                              },
                              "textStart": {
                                "type": "integer"
                              },
                              "textEnd": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "shares": {
                          "type": "object",
                          "properties": {
                            "facebook": {
                              "type": "integer"
                            }
                          }
                        },
                        "wgt": {
                          "type": "integer"
                        }
                      }
                    },
                    "storyDate": {
                      "type": "string"
                    },
                    "isUserSetDate": {
                      "type": "boolean"
                    },
                    "extractedDate": {
                      "type": "string"
                    },
                    "averageDate": {
                      "type": "string"
                    },
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "commonDates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "amb": {
                            "type": "boolean"
                          },
                          "imp": {
                            "type": "boolean"
                          },
                          "date": {
                            "type": "string"
                          },
                          "textStart": {
                            "type": "integer"
                          },
                          "textEnd": {
                            "type": "integer"
                          },
                          "freq": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "socialScore": {
                      "type": "double"
                    },
                    "wgt": {
                      "type": "integer"
                    }
                  }
                }
              },
              "eventDate": {
                "type": "string"
              },
              "totalArticleCount": {
                "type": "integer"
              },
              "title": {
                "type": "object",
                "properties": {
                  "eng": {
                    "type": "string"
                  }
                }
              },
              "summary": {
                "type": "object",
                "properties": {
                  "eng": {
                    "type": "string"
                  }
                }
              },
              "location": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "object",
                    "properties": {
                      "eng": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "categories": {
                "type": "object",
                "properties": {
                  "uri": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "wgt": {
                    "type": "integer"
                  }
                }
              },
              "images": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "articleCounts": {
                "type": "object",
                "properties": {
                  "eng": {
                    "type": "integer"
                  }
                }
              },
              "socialScore": {
                "type": "double"
              },
              "commonDates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "amb": {
                      "type": "boolean"
                    },
                    "imp": {
                      "type": "boolean"
                    },
                    "date": {
                      "type": "string"
                    },
                    "textStart": {
                      "type": "integer"
                    },
                    "textEnd": {
                      "type": "integer"
                    },
                    "freq": {
                      "type": "integer"
                    }
                  }
                }
              },
              "wgt": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "uriWgtList": {
      "type": "object",
      "properties": {
        "totalResults": {
          "type": "integer"
        },
        "page": {
          "type": "integer"
        },
        "count": {
          "type": "integer"
        },
        "pages": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "conceptAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "uri": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              },
              "label": {
                "type": "object",
                "properties": {
                  "eng": {
                    "type": "string"
                  }
                }
              },
              "image": {
                "type": "string"
              },
              "synonyms": {
                "type": "object",
                "properties": {}
              },
              "trendingScore": {
                "type": "object",
                "properties": {
                  "news": {
                    "type": "object",
                    "properties": {
                      "score": {
                        "type": "double"
                      },
                      "testPopFq": {
                        "type": "integer"
                      },
                      "nullPopFq": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "location": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "object",
                    "properties": {
                      "eng": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "keywordAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "keyword": {
                "type": "string"
              },
              "weight": {
                "type": "double"
              }
            }
          }
        }
      }
    },
    "locAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "count": {
                "type": "string"
              },
              "concept": {
                "type": "object",
                "properties": {
                  "uri": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "object",
                    "properties": {
                      "eng": {
                        "type": "string"
                      }
                    }
                  },
                  "location": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "label": {
                        "type": "object",
                        "properties": {
                          "eng": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "timeAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string"
              },
              "count": {
                "type": "double"
              }
            }
          }
        }
      }
    },
    "sourceAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "uri": {
                "type": "string"
              },
              "dataType": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "object",
                    "properties": {
                      "eng": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "locationValidated": {
                "type": "boolean"
              },
              "ranking": {
                "type": "object",
                "properties": {
                  "importanceRank": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "conceptGraph": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "concepts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "uri": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              },
              "label": {
                "type": "object",
                "properties": {
                  "eng": {
                    "type": "string"
                  }
                }
              },
              "image": {
                "type": "string"
              },
              "synonyms": {
                "type": "object",
                "properties": {}
              },
              "trendingScore": {
                "type": "object",
                "properties": {
                  "news": {
                    "type": "object",
                    "properties": {
                      "score": {
                        "type": "double"
                      },
                      "testPopFq": {
                        "type": "integer"
                      },
                      "nullPopFq": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "location": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "object",
                    "properties": {
                      "eng": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "links": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "uri1": {
                "type": "string"
              },
              "uri2": {
                "type": "string"
              },
              "score": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "categoryAggr": {
      "type": "object",
      "properties": {
        "warning": {
          "type": "string"
        },
        "usedResults": {
          "type": "integer"
        },
        "totalResults": {
          "type": "integer"
        },
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "example": "dmoz/Business/Investing/Stocks_and_Bonds"
              },
              "score": {
                "type": "double",
                "example": 0.123
              }
            }
          }
        }
      }
    },
    "recentActivityEvents": {
      "type": "object",
      "properties": {
        "currTime": {
          "type": "string"
        },
        "activity": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {}
          }
        }
      }
    }
  }
}
```
