Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 2.19 KB

File metadata and controls

58 lines (40 loc) · 2.19 KB
code type title description
true
page
SearchAsync
Searches documents.

SearchAsync

Searches documents.

There is a limit to how many documents can be returned by a single search query. That limit is by default set at 10000 documents, and you can't get over it even with the from and size pagination options.

:::info When processing a large number of documents (i.e. more than 1000), it is advised to paginate the results using SearchResult.Next rather than increasing the size parameter. :::

Arguments

public async Task<SearchResults> SearchAsync(
    string index, 
    string collection, 
    JObject query,
    SearchOptions options = null);

Argument Type Description
index
string
Index name
collection
string
Collection name
query
JObject
JObject representing the search query
options
SearchOptions
An instance of SearchOptions class

query

A JObject representing the query. Query can have the following root properties:

An empty body matches all documents in the queried collection.

Return

Returns a SearchResult instance.

Exceptions

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

Usage

<<< ./snippets/search.cs