where argument in get and query is used to filter records by their metadata. For example, in this query operation, Chroma will only query records that have the page metadata field with the value 10:
where filter dictionary to the query. The dictionary must have the following structure:
$eq operator is equivalent to using the metadata field directly in your where filter.
page metadata field is greater than 10:
Using Logical Operators
You can also use the logical operators$and and $or to combine multiple filters.
An $and operator will return results that match all the filters in the list.
page metadata field is between 5 and 10:
$or operator will return results that match any of the filters in the list.
color metadata field is red or blue:
Using Inclusion Operators
The following inclusion operators are supported:$in- a value is in predefined list (string, int, float, bool)$nin- a value is not in predefined list (string, int, float, bool)
$in operator will return results where the metadata attribute is part of a provided list:
$nin operator will return results where the metadata attribute is not part of a provided list (or the attribute’s key is not present):
author metadata field is in a list of possible values:
Combining with Document Search
.get and .query can handle metadata filtering combined with document search: