SDK
SDK Javascript v6.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

searchProfiles #

Searches security profiles, optionally returning only those linked to the provided list of security roles.


searchProfiles([body], [options]);

PropertyTypeDescription
body
object
Query including role identifiers to search for
options
object
Query options

body #

PropertyTypeDescription
roles
array<string>
Role identifiers

options #

PropertyType
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again
from
number

(0)
Offset of the first document to fetch
size
number

(10)
Maximum number of documents to retrieve per page
scroll
string

("")
When set, gets a forward-only cursor having its ttl set to the given value (ie 30s; cf elasticsearch time limits)

Resolves #

A SearchResult object containing the retrieved Profile objects.

Usage #

try {
  const results = await kuzzle.security.searchProfiles({
    roles: [ 'default' ]
  });
  console.log(results);
  /*
  ProfileSearchResult { aggregations: undefined,
    hits:
      [ Profile { _id: 'profile1', policies: [Array] },
        Profile { _id: 'profile2', policies: [Array] },
        Profile { _id: 'profile3', policies: [Array] },
        Profile { _id: 'default', policies: [Array] } ],
    fetched: 4,
    total: 4 }
   */
  console.log(`Successfully retrieved ${results.total} profiles`);
} catch (e) {
  console.error(e);
}