searchSpecifications #
Retrieves every specifications across indexes/collections according to the given filters.
searchSpecifications(filters, [options], callback) #
Arguments | Type | Description |
---|---|---|
filters | JSON object | Search request body, using ElasticSearch Query DSL format. If given an empty object, matches all specifications across index/collections |
options | JSON object | Optional parameters |
callback | function | Callback handling the response |
Options #
Option | Type | Description | Default |
---|---|---|---|
from | number | Provide the starting offset of the request (used to paginate results) | 0 |
queuable | boolean | Make this request queuable or not | true |
scroll | string | Start a scroll session, with a time to live equals to this parameter's value following the Elastisearch time format | undefined |
size | number | Provide the maximum number of results of the request (used to paginate results) | 10 |
Usage #
import io.kuzzle.sdk.core.Kuzzle;
import io.kuzzle.sdk.core.Options;
Kuzzle kuzzle = new Kuzzle("localhost");
JSONObject filters = new JSONObject()
.put("match_all", new JSONObject()
.put("boost", 1)
);
Options options = new Options();
options.setFrom((long) 0);
options.setSize((long) 20);
kuzzle
.collection("collection", "index")
.searchSpecifications(filters, options, new ResponseListener<JSONObject>() {
@Override
public void onSuccess(JSONObject res) {
for (int i = 0; i < res.getJSONArray("hits").length(); i++) {
res.getJSONArray("hits").getJSONObject(i) // Specification
}
res.getString("total"); // Total specifications count
}
@Override
public void onError(JSONObject error) {
// Handle error
}
});
Callback response
{
"hits": [{ "first": "specification" }, { "second": "specification" }],
"total": 2,
"scrollId": "foobar"
}
Edit this page on Github(opens new window)