searchSpecifications

Searches collection specifications.

Arguments

Copied to clipboard!
  public io.kuzzle.sdk.SpecificationSearchResult searchSpecifications(
    String query,
    io.kuzzle.sdk.QueryOptions
  )
  public io.kuzzle.sdk.SpecificationSearchResult searchSpecifications(
    String query
  )

Argument Type Description
query
String
A JSON string containing the query of the document
options
io.kuzzle.sdk.QueryOptions
The query options

Options

Option Type (default) Description
queuable
boolean
(true)
If true, queues the request during downtime, until connected to Kuzzle again
from
int

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

Optional:

An empty body matches all documents in the queried collection.

Return

Returns a io.kuzzle.sdk.SearchResult object.

Exceptions

Throws a io.kuzzle.sdk.KuzzleException if there is an error. See how to handle error.

Usage

Copied to clipboard!
try {
  QueryOptions options = new QueryOptions();
  options.setScroll("1m");
  options.setSize(2);

  SearchResult response = kuzzle.getCollection().searchSpecifications(
    "{\"query\":{\"match_all\": {}}}",
    options
  );

  System.out.println(String.format("Successfully retrieved %d specifications", response.getTotal()));
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}