Method Overloads
Thequery method supports two calling patterns:
Pattern 1: Individual Parameters
Pattern 2: Request Object
Parameters
Individual Parameters Pattern
Request Object Pattern
Returns
Promise<QueryResponse>: A Promise that resolves to search results. The response format depends on whether a single vector or multiple vectors were queried:
- Single vector query:
resultsis a flat array ofQueryResultItem[] - Batch query:
resultsis a nested array ofQueryResultItem[][](one array per input vector)
Exceptions
Error
Error
- Throws if the API request fails due to network connectivity issues.
- Throws if authentication fails (invalid API key).
- Throws if the encryption key is invalid for the specified index.
- Throws if there are internal server errors during the search.
Validation Errors
Validation Errors
- Throws if no query vector is provided.
- Throws if vector dimensions don’t match the index configuration.
- Throws if parameter values are out of valid ranges.
- Throws if the
includeparameter contains invalid field names.