Official Plugins (Kuzzle v2.x)
multi-tenancy v1.x
2

search #

Searches for a tenant's users.

See also security:searchUsers

User can only act on tenant they belongs.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/_/multi-tenancy/tenant/:tenantId/users/_search[&from=<int>][&size=<int>][&scroll=<time to live>][&lang=<query language>]
Method: POST
Body:
Copied to clipboard!
{
  "query": {
    // ...
  },
  "sort": [
    // ...
  ]
}

You can also access this route with the GET verb:

Copied to clipboard!
URL: http://kuzzle:7512/_/multi-tenancy/tenant/:tenantId/users/_search[?searchBody=<string>][&from=<int>][&size=<int>][&lang=<query language>]
Method: GET

Other protocols #

Copied to clipboard!
{
  "controller": "multi-tenancy/user",
  "action": "search",

  "tenantId": "<tenant ID>",

  "body": {
    "query": {
      // ...
    },
    "sort": [
      // ...
    ]
  }

  // optional:
  "from": "<starting offset>",
  "size": "<page size>",
  "lang": "<query language>"
}

Arguments #

  • tenantId: Tenant ID

Optional: #

  • from: paginates search results by defining the offset from the first result you want to fetch. Usually used with the size argument
  • size: set the maximum number of documents returned per result page
  • lang: specify the query language to use. By default, it's koncorde but elasticsearch can also be used.

Body properties #

The search query itself, using the ElasticSearch Query DSL or the Koncorde Filters DSL syntax.

If the body is left empty, the result will return all available users for this tenant.


Response #

Returns an object with the following properties:

  • hits: array of object. Each object describes a found user:
    • _id: user kuid
    • _source: user definition
  • total: total number of users found. Depending on pagination options, this can be greater than the actual number of users in a single result page
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "action": "search",
  "controller": "multi-tenancy/user",
  "requestId": "<unique request identifier>",
  "result": {
    "total": 2,
    "hits": [
      {
        "_id": "<kuid>",
        "_source": {
          // User content
        }
      },
      {
        "_id": "<kuid>",
        "_source" {
          // User content
        }
      }
    ]
  }
}