SDK
SDK C++ v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

searchSpecifications #

Searches collection specifications.

There is a limit to 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.

Signature #

kuzzleio::SearchResult* searchSpecifications(const std::string& query);

kuzzleio::SearchResult* searchSpecifications(
    const std::string& query,
    const kuzzleio::query_options& options);

Arguments #

ArgumentTypeDescription
query
const std::string&
JSON string representing the query to match
options
kuzzleio::query_options*
Query options

options #

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

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

(10)
Maximum number of documents to retrieve per page
scroll
const std::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 kuzzleio::SearchResult.

Exceptions #

Throws a kuzzleio::KuzzleException if there is an error. See how to handle errors.

Usage #

try {
  kuzzleio::query_options options;
  options.from = 0;
  options.size = 2;
  kuzzleio::SearchResult* response = kuzzle->collection->searchSpecifications(
    R"({
      "query": {
        "match_all": {}
      }
    })",
    options);
  std::cout << "Successfully retrieved " << response->fetched() << " specifications" << std::endl;
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}