Class KnnQueryDescriptor<T>
Inheritance
KnnQueryDescriptor<T>
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class KnnQueryDescriptor<T> : FieldNameQueryDescriptorBase<KnnQueryDescriptor<T>, IKnnQuery, T>, IDescriptor, IKnnQuery, IFieldNameQuery, IQuery where T : class
Type Parameters
Properties
|
Edit this page
View Source
Conditionless
Whether the query is conditionless. A conditionless query is not serialized as part of the request
sent to OpenSearch.
Declaration
protected override bool Conditionless { get; }
Property Value
Overrides
Methods
|
Edit this page
View Source
ExpandNestedDocs(bool?)
Whether to expand and search over the nested documents of each matching parent document.
Supported from OpenSearch 2.19.
Declaration
public KnnQueryDescriptor<T> ExpandNestedDocs(bool? expandNestedDocs = true)
Parameters
| Type |
Name |
Description |
| bool? |
expandNestedDocs |
|
Returns
|
Edit this page
View Source
Filter(Func<QueryContainerDescriptor<T>, QueryContainer>)
The result restriction filter query.
Declaration
public KnnQueryDescriptor<T> Filter(Func<QueryContainerDescriptor<T>, QueryContainer> filterSelector)
Parameters
Returns
|
Edit this page
View Source
K(int?)
The number of neighbors the search of each graph will return.
Declaration
public KnnQueryDescriptor<T> K(int? k)
Parameters
| Type |
Name |
Description |
| int? |
k |
|
Returns
|
Edit this page
View Source
MaxDistance(float?)
The maximum physical vector space distance required in order for a neighbor to be considered a hit.
Declaration
public KnnQueryDescriptor<T> MaxDistance(float? maxDistance)
Parameters
| Type |
Name |
Description |
| float? |
maxDistance |
|
Returns
|
Edit this page
View Source
MethodParameters(Func<FluentDictionary<string, object>, FluentDictionary<string, object>>)
Additional engine-specific parameters that control the approximate k-NN search at query time,
such as ef_search (HNSW) or nprobes (IVF). Supported from OpenSearch 2.16.
Declaration
public KnnQueryDescriptor<T> MethodParameters(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> selector)
Parameters
Returns
|
Edit this page
View Source
MinScore(float?)
The minimum similarity score required in order for a neighbor to be considered a hit.
Declaration
public KnnQueryDescriptor<T> MinScore(float? minScore)
Parameters
| Type |
Name |
Description |
| float? |
minScore |
|
Returns
|
Edit this page
View Source
Rescore(Func<KnnQueryRescoreContextDescriptor, IKnnQueryRescoreContext>)
Controls the rescoring of approximate k-NN search results using full-precision vectors.
Pass a bool to enable or disable rescoring, or a KnnQueryRescoreContext
to configure it. Supported from OpenSearch 2.17.
Declaration
public KnnQueryDescriptor<T> Rescore(Func<KnnQueryRescoreContextDescriptor, IKnnQueryRescoreContext> selector)
Parameters
Returns
|
Edit this page
View Source
Rescore(bool?)
Controls the rescoring of approximate k-NN search results using full-precision vectors.
Pass a bool to enable or disable rescoring, or a KnnQueryRescoreContext
to configure it. Supported from OpenSearch 2.17.
Declaration
public KnnQueryDescriptor<T> Rescore(bool? enable = true)
Parameters
| Type |
Name |
Description |
| bool? |
enable |
|
Returns
|
Edit this page
View Source
Vector(params float[])
The vector to search for.
Declaration
public KnnQueryDescriptor<T> Vector(params float[] vector)
Parameters
| Type |
Name |
Description |
| float[] |
vector |
|
Returns
Implements
Extension Methods