Class NeuralQueryDescriptor<T>
Inheritance
NeuralQueryDescriptor<T>
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class NeuralQueryDescriptor<T> : FieldNameQueryDescriptorBase<NeuralQueryDescriptor<T>, INeuralQuery, T>, IDescriptor, INeuralQuery, 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?)
When true, retrieves scores for all nested field documents within each parent document.
Used with nested queries.
Declaration
public NeuralQueryDescriptor<T> ExpandNestedDocs(bool? expandNestedDocs = true)
Parameters
| Type |
Name |
Description |
| bool? |
expandNestedDocs |
|
Returns
|
Edit this page
View Source
Filter(Func<QueryContainerDescriptor<T>, QueryContainer>)
A query used to reduce the number of documents considered.
Declaration
public NeuralQueryDescriptor<T> Filter(Func<QueryContainerDescriptor<T>, QueryContainer> filterSelector)
Parameters
Returns
|
Edit this page
View Source
K(int?)
The number of results the k-NN search returns. Only one of K, MaxDistance,
or MinScore can be specified; if none is set, the server default is k = 10.
Declaration
public NeuralQueryDescriptor<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 (radial search).
Only one of K, MaxDistance, or MinScore can be specified.
Declaration
public NeuralQueryDescriptor<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).
Declaration
public NeuralQueryDescriptor<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 (radial search).
Only one of K, MaxDistance, or MinScore can be specified.
Declaration
public NeuralQueryDescriptor<T> MinScore(float? minScore)
Parameters
| Type |
Name |
Description |
| float? |
minScore |
|
Returns
|
Edit this page
View Source
ModelId(string)
The ID of the model that will be used in the embedding interface.
The model must be indexed in OpenSearch before it can be used in Neural Search.
Declaration
public NeuralQueryDescriptor<T> ModelId(string modelId)
Parameters
| Type |
Name |
Description |
| string |
modelId |
|
Returns
|
Edit this page
View Source
QueryImage(string)
A Base64-encoded string that corresponds to the query image from which to generate vector embeddings.
You must specify at least one of QueryText or QueryImage.
Declaration
public NeuralQueryDescriptor<T> QueryImage(string queryImage)
Parameters
| Type |
Name |
Description |
| string |
queryImage |
|
Returns
|
Edit this page
View Source
QueryText(string)
The query text from which to produce queries.
You must specify at least one of QueryText or QueryImage.
Declaration
public NeuralQueryDescriptor<T> QueryText(string queryText)
Parameters
| Type |
Name |
Description |
| string |
queryText |
|
Returns
|
Edit this page
View Source
QueryTokens(Func<FluentDictionary<string, float>, FluentDictionary<string, float>>)
A raw sparse vector, expressed as tokens and their weights. Used as an alternative to
QueryText for direct vector input.
Declaration
public NeuralQueryDescriptor<T> QueryTokens(Func<FluentDictionary<string, float>, FluentDictionary<string, float>> selector)
Parameters
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.
Declaration
public NeuralQueryDescriptor<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.
Declaration
public NeuralQueryDescriptor<T> Rescore(bool? enable = true)
Parameters
| Type |
Name |
Description |
| bool? |
enable |
|
Returns
|
Edit this page
View Source
SemanticFieldSearchAnalyzer(string)
An analyzer for tokenizing QueryText when using a sparse encoding model.
Cannot be used together with ModelId.
Declaration
public NeuralQueryDescriptor<T> SemanticFieldSearchAnalyzer(string analyzer)
Parameters
| Type |
Name |
Description |
| string |
analyzer |
|
Returns
Implements
Extension Methods