code | type | title | description |
---|---|---|---|
true |
page |
SearchAsync |
Searches documents. |
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. :::
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 |
A JObject representing the query. Query can have the following root properties:
query
: the search query itself, using the ElasticSearch Query DSL syntax.aggregations
: control how the search results should be aggregatedsort
: contains a list of fields, used to sort search results, in order of importance.
An empty body matches all documents in the queried collection.
Returns a SearchResult instance.
Throws a KuzzleException
if there is an error. See how to handle errors.
<<< ./snippets/search.cs