SDK
SDK Dart v1.x
2

# searchUsers

Searches users.


Copied to clipboard!
Future<UserSearchResult> searchUsers(
      {Map<String, dynamic> query, int from, int size, String scroll})

Property Type Description
query
Map<String, dynamic>
Search query
from
int

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

(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)

# query

The search query to apply to users content, using ElasticSearch Query DSL syntax.

If left empty, the result will return all available users.

# Return

A UserSearchResult object containing the retrieved User objects.

# Usage

Copied to clipboard!
final result = await kuzzle.security.searchUsers(query:{
  'query': {
    'term': {
      'status': 'student'
    }
  }
});
/*
UserSearchResult {
  aggregations: undefined,
  hits:
    [ User { _kuzzle: [Kuzzle], _id: 'user2', content: [Object] },
      User { _kuzzle: [Kuzzle], _id: 'user1', content: [Object] },
      User { _kuzzle: [Kuzzle], _id: 'user3', content: [Object] } ],
  fetched: 3,
  total: 3 }
*/