searchUsers #
Searches users.
Future<UserSearchResult> searchUsers(
{Map<String, dynamic> query, int from, int size, String scroll})Available since change-me
This method also supports the Koncorde Filters DSL to match documents by passing the lang argument with the value koncorde.
Koncorde filters will be translated into an Elasticsearch query.
Koncorde bool operator and regexp clause are not supported for search queries.
| 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) |
lang | String | Specify the query language to use. By default, it's elasticsearch but koncorde can also be used. Available since change-me |
query #
The search query to apply to users content, using ElasticSearch Query DSL or the Koncorde Filters DSL syntax.
If left empty, the result will return all available users.
Return #
A UserSearchResult object containing the retrieved User objects.
Usage #
With the ElasticSearch Query DSL syntax.
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 }
*/With the Koncorde Filters DSL syntax.
final result = await kuzzle.security.searchUsers(query: {
'query': {
'equals': {
'status': 'student'
}
}
}, lang: 'koncorde');
/*
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 }
*/