Skip to main content
Search is the retrieval layer for the knowledge and memory stored in LambdaDB collections. A search query, or query, requests documents that match an application’s current context or criteria. LambdaDB supports several search methods: For dense vector fields, supply your own embeddings with knn.queryVector, or configure native embeddings and search with knn.queryText so LambdaDB generates the query vector with the field’s model. To evaluate and reorder retrieved candidates with a model provided by LambdaDB, add query-level native reranking. This is separate from vector retrieval and hybrid fusion. To count matching documents by keyword value, add keyword facets to a supported lexical query or omit the query for match-all counts. Facets cannot be combined with vector, sparse vector, or hybrid queries. Common parameters for the request body of a query are as follows:
Depending on your data and your query, you may get fewer than size results. This happens when size is larger than the number of possible matching documents for your query.
Setting includeVectors (or include_vectors in Python) to true will increase response size significantly, especially for high-dimensional vectors. Use this option only when vector data is specifically needed for your application.
include is applied first, and then exclude is applied to the included fields when you set both in the fields parameter.
LambdaDB is eventually consistent by default, so there can be a slight delay before new or changed documents are visible to queries. If your application requires strong (read-after-write) consistency, set consistentRead (or consistent_read in Python) to true when querying a branch directly, at the expense of potential higher latency and cost. Tag and alias reads reject consistentRead: true, including an alias that targets a branch.This overlays eligible pending writes; pending bulk imports remain invisible until committed. A pending payload above the consistent-read limit returns 429. See Consistent reads.
Query results are returned in the following format: total counts the returned documents even when they are delivered through docsUrl; it is not a count of every document matching the query. A document’s score can be omitted when the query does not compute one. Applied reranking uses score for the final evaluation value in [0,1] and adds the original search score as retrievalScore alongside doc. Fallback preserves search scores and omits retrievalScore. Check rerank.status before interpreting scores; evaluation scores are not relevance probabilities. See Reranking responses. Large results may be returned through docsUrl instead of inline docs. See Large results for REST download instructions and SDK behavior. Partitioning is configured by the application through the collection’s partitionConfig. On a partitioned collection, top-level partitionFilter limits the request to the physical partitions associated with the supplied field values. Other partitions are not searched. Without partitionFilter, the search scope includes all partitions. For example, assume the collection has a tenant_id keyword index, a content text index, and partitionConfig set to { "fieldName": "tenant_id", "dataType": "keyword", "numPartitions": 4 }. Send this query body to search the authorized tenant’s data:
field must match the configured partition field, and in contains field values, not physical partition IDs. Hash partitioning can place several field values in the same physical partition; the request also restricts matches to the supplied values. Derive permitted values in your backend from the caller’s authorization. Use query predicates, including knn.filter, for additional document conditions within that search scope. A document predicate alone does not replace partitionFilter for skipping physical partitions. Internal sharding distributes query execution and has no user-facing configuration; it is separate from this explicit partition selection. See Create a partitioned collection for setup and Read usage for the effect of partition selection on billing.

Example

To query a specific ref over REST, add "ref": { "kind": "branch", "name": "candidate" } alongside query and size. Omitting ref selects main. See Branches, tags, and aliases. The response will look like this:
Without explicit sorting or applied reranking, scored results are ordered by descending retrieval score: BM25 for full-text search, the configured similarity metric for vector search, or the selected fusion method for hybrid search. Applied reranking orders candidates by their final evaluation score and preserves the retrieval score in retrievalScore.