query_metadata() evaluates a filter expression entirely against the encrypted metadata index and returns the matching items. Pass text to rank matches by BM25 full-text relevance instead (see Full-text and hybrid search).
Parameters
- Without
order_by(and withouttext), the result is an unordered subset of matching items. - Items missing the
order_byfield (or holding a non-scalar value) sort last. - Metadata-only queries work on untrained indexes.
$typeis not supported on this endpoint.$regex/$containsrequire the field to have been declaredpattern: truein the index’smetadata_schema; a field declaredfilterable: falsecannot be filtered on here at all. Both raiseValueError— run the same filter throughquery()with a vector if you need to bypass the schema constraint. Nested dot-paths (owner.name) are supported.
Returns
List[Dict[str, Any]]: One dictionary per matching item. Each carries id (str). When text is set, each also carries score (float, the BM25 score) and results are sorted by descending score; without text, there is no score key.
Exceptions
ValueError
ValueError
- Throws if
order_byis a dict with more than one field. - Throws if
order_byis neither a field name (str) nor a single-field dict. - Throws if
textis passed but the index has nofull_textfield, ortext_fieldsnames a field that is notfull_text. - Throws if any
text_*parameter is set without a non-emptytext. - Throws if the query could not be executed.