Core
IoT Platform v2.x
2

search #

Searches for notification rules.


Query Syntax #

HTTP #

[//]: # (URL: http://kuzzle:7512/notifications/:index/_search[?from=<int>][&size=<int>])
[//]: # (Method: POST)
[//]: # (Body:)
{
  "query": {
    // query
  },
  "aggregations": {
      // ...
  },
  "sort": {
    // sort
  },
}

Javascript #

kuzzle.query({
  controller: 'notifications',
  action: 'search',
  index: '<index>',
  from: 0, // integer
  size: 10, // integer
  body: {
    query: {
      // query
    },
    sort: {
      // sort
    },
  },
});

Arguments #

  • index : Tenant index
  • from : Offset of the first notification rule to fetch
  • size : Maximum number of notification rules to fetch

Optional: #

  • query: the search query itself, using the ElasticSearch Query DSL
  • aggregations: control how the search result should be aggregated
  • sort: contains a list of fields, used to sort search results, in order of importance

Response #

Returns a list of notification rules.

{
  "status": 200,
  "error": null,
  "controller": "notifications",
  "action": "search",
  "index": "<tenant-air_quality-kuzzle>",
  "requestId": "<unique request identifier>",
  "result": {
    "total": 1,
    "hits": [
      {
        "_id": "<notification rule id>",
        "_score": 1,
        "_source": {
          // rule content
      },
      {
        "_id": "<another notification rule id>",
        "_score": 1,
        "_source": {
          // rule content
      },
    ],
    "total": 2
  }
}