SDK
SDK C# v2.x
2

SearchSpecificationsAsync #

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 SearchResults.next rather than increasing the size parameter.

Arguments #

Copied to clipboard!
public async Task<DataObjects.SearchResults> SearchSpecificationsAsync(
        JObject filters,
        Options.SearchOptions options = null);
Argument Type Description
filters
JObject
JObject representing the query to match
options
Options.SearchOptions
Query options

options #

Options Type Description
From
int

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

(10)
Maximum number of documents to retrieve per page
Scroll
string

(null)
When set, gets a forward-only cursor having its TTL set to the given value (i.e. 30s; cf. Elasticsearch time limits)

Return #

Returns a SearchResults.

Exceptions #

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

Usage #

Copied to clipboard!
try {
  SearchOptions options = new SearchOptions();
  options.From = 0;
  options.Size = 2;
  SearchResults response = await kuzzle.Collection.SearchSpecificationsAsync(
    JObject.Parse(@"{
      query: {
        match_all: {}
      }
    }"),
    options);
  Console.WriteLine($"Successfully retrieved {response.Fetched} specifications");
} catch (Exception e) {
  Console.WriteLine(e);
}