id: The unique identifier of the matching point.score: Similarity score based on the collection’s distance metric.payload: Metadata dictionary (only ifwith_payload=True).vector: Vector embedding (only ifwith_vectors=True).
Universal Query API
Thequery() method provides a unified interface for all search operations, including vector search, payload-based ordering, and batch queries. This API simplifies complex queries and offers more flexibility than the basic search() method.
Basic query
Usequery() for standard vector search:
id: The unique identifier of the matching point.score: Similarity score based on the collection’s distance metric.payload: Metadata dictionary containing point data.
Order by payload field
Sort results by payload fields without using vectors:id: The unique identifier of the point.payload: Metadata dictionary containing the point data.score: Ordering score (may be null when using order_by without vector query).
- Find highest or lowest prices.
- Sort by date, newest or oldest.
- Rank by rating or popularity.
- Browse without semantic search.
Batch queries
Execute multiple queries in a single request:- Single network round trip for multiple queries
- Better throughput than individual requests
- Reduced server overhead
- Ideal for multi-query RAG applications
id: The unique identifier of the matching point.score: Similarity score for the query.payload: Metadata dictionary if requested.vector: Vector embedding if requested.
Query with filters and ordering
Combine vector search with filters and custom ordering:id: The unique identifier of the matching point.score: Relevance score based on similarity or ordering criteria.payload: Metadata dictionary containing the point data.
Choose between query() and search()
Usequery() when:
- Sorting by payload fields (order-by)
- Running batch queries
- You need the unified API for consistency
- Building flexible query systems
search() when:
- Pure vector similarity search
- Simpler code is preferred
- Using established search patterns
- No need for order-by or batching
Interpret semantic search results
Each search result contains these components:Required fields
id: Vector identifier as an integer.score: Similarity measure as a float.
Optional fields
payload: Metadata dictionary whenwith_payload=True.vector: Embedding array whenwith_vectors=True.