Path parameters
- index
string | array[string] Required A comma-separated list of index names to search; use
_all
or to perform the operation on all indices.
Query parameters
- routing
string A comma-separated list of specific routing values.
Body
_source
boolean | object Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
- docvalue_fields
array[object] The request returns doc values for field names matching these patterns in the
hits.fields
property of the response. It accepts wildcard (*
) patterns. - stored_fields
string | array[string] - fields
string | array[string] filter
object | array[object] A query to filter the documents that can match. The kNN search will return the top
k
documents that also match this filter. The value can be a single query or a list of queries. Iffilter
isn't provided, all documents are allowed to match.One of: An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation - knn
object Required
curl \
--request GET 'http://api.example.com/{index}/_knn_search' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"":true,"docvalue_fields":[{"field":"string","format":"string","include_unmapped":true}],"stored_fields":"string","fields":"string","filter":{},"knn":{"field":"string","query_vector":[42.0],"k":42.0,"num_candidates":42.0}}'