searchSpecifications #
Searches collection specifications.
There is a limit on how many items can be returned by a single search query. That limit is by default set at 10000, and you can't get over it even with the from and size pagination options.
When processing a large number of items (i.e. more than 1000), it is advised to paginate the results using SearchResult.next rather than increasing the size parameter.
Future<SearchResult> searchSpecifications(
String index, {
Map<String, dynamic> query,
int from,
int size,
String scroll,
})
Arguments | Type | Description |
---|---|---|
index | String | The index in which the collection is in |
query | Map<String, dynamic> ( {} ) | An object containing the 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 1s ; cf elasticsearch time limits) |
query body properties: #
query
: the search query itself, using the ElasticSearch Query DSL syntax.aggregations
: control how the search results should be aggregatedsort
: contains a list of fields, used to sort search results, in order of importance.
An empty body matches all documents in the queried collection.
Return #
Returns a SearchResult object.
Usage #
final result = await kuzzle
.collection
.searchSpecifications(
'nyc-open-data',
query: {
'query': {
'match_all': {}
}
},
from: 0,
size: 50,
scroll: '10s');
Edit this page on Github(opens new window)