Annotation Interface VectorSearch
SearchResults and limited by either a
Score (within) or a Range of scores
(between).
Vector search must define an index name using the indexName() attribute. The index must be created in the
MongoDB Atlas cluster before executing the query. Any misspelling of the index name will result in returning no
results.
When using pre-filters, you can either define filter() or use query derivation to define the pre-filter.
Vector and distance parameters are considered once these are present. Vector
search supports sorting and will consider Sort parameters.
- Since:
- 5.0
- Author:
- Mark Paluch
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionTakes a MongoDB JSON (MQL) string defining the pre-filter against indexed fields.Number of documents to return in the results.Number of nearest neighbors to use during the search.Indexed vector type field to search.Configuration whether to useVectorSearchOperation.SearchType.ANNorVectorSearchOperation.SearchType.ENNfor the search.Takes a MongoDB JSON (MQL) string defining the pre-filter against indexed fields.
-
Element Details
-
searchType
VectorSearchOperation.SearchType searchTypeConfiguration whether to useVectorSearchOperation.SearchType.ANNorVectorSearchOperation.SearchType.ENNfor the search.- Returns:
- the search type to use.
- Default:
DEFAULT
-
indexName
Name of the Atlas Vector Search index to use. Atlas Vector Search doesn't return results if you misspell the index name or if the specified index doesn't already exist on the cluster.- Returns:
- name of the Atlas Vector Search index to use.
-
path
String pathIndexed vector type field to search. This is defaulted from the domain model using the first Vector property found.- Returns:
- an empty String by default.
- Default:
""
-
value
Takes a MongoDB JSON (MQL) string defining the pre-filter against indexed fields. Supports Value Expressions. Alias forfilter().- Returns:
- an empty String by default.
- Default:
""
-
filter
-
limit
String limitNumber of documents to return in the results. This value can't exceed the value ofnumCandidates()if you specifynumCandidates(). Limit accepts Value Expressions. A Vector Search method cannot define both,limit()and aLimitparameter. Supports Value Expressions.- Returns:
- number of documents to return in the results.
- Default:
""
-
numCandidates
String numCandidatesNumber of nearest neighbors to use during the search. Value must be less than or equal to (<=)10000. You can't specify a number less than thenumber of documents to return. We recommend that you specify a number at least20times higher than thenumber of documents to returnto increase accuracy.This over-request pattern is the recommended way to trade off latency and recall in your ANN searches, and we recommend tuning this parameter based on your specific dataset size and query requirements. Required if the query uses
VectorSearchOperation.SearchType.ANN/VectorSearchOperation.SearchType.DEFAULT. Supports Value Expressions.- Returns:
- number of nearest neighbors to use during the search.
- Default:
""
-