searchProfiles #
Searches security profiles, optionally returning only those linked to the provided list of security roles.
searchProfiles([body], [options]);| Property | Type | Description |
|---|---|---|
body | object | Query including role identifiers to search for |
options | object | Query options |
body #
| Property | Type | Description |
|---|---|---|
roles | array<string> | Role identifiers |
options #
| Property | Type (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);
}