Skip to content

Commit 33a2e94

Browse files
authored
Add docs for Vectorize $in and $nin (#18149)
* Add docs for Vectorize $in and $nin * Add $nin example
1 parent 1a0eb38 commit 33a2e94

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/content/changelogs/vectorize.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ productLink: "/vectorize/"
55
productArea: Developer platform
66
productAreaLink: /workers/platform/changelog/platform/
77
entries:
8+
- publish_date: "2024-11-13"
9+
title: Added support for `$in` and `$nin` metadata filters
10+
description: |-
11+
Vectorize now supports `$in` and `$nin` clauses in [metadata filters](/vectorize/reference/metadata-filtering/).
12+
813
- publish_date: "2024-10-28"
914
title: Improved query latency through REST API
1015
description: |-

src/content/docs/vectorize/reference/metadata-filtering.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ Optional `filter` property on `query()` method specifies metadata filter:
3737
| -------- | ----------- |
3838
| `$eq` | Equals |
3939
| `$ne` | Not equals |
40+
| `$in` | In |
41+
| `$nin` | Not in |
4042

4143
- `filter` must be non-empty object whose compact JSON representation must be less than 2048 bytes.
4244
- `filter` object keys cannot be empty, contain `" | .` (dot is reserved for nesting), start with `$`, or be longer than 512 characters.
43-
- `filter` object non-nested values can be `string`, `number`, `boolean`, or `null` values.
45+
- For `$eq` and `$ne`, `filter` object non-nested values can be `string`, `number`, `boolean`, or `null` values.
46+
- For `$in` and `$nin`, `filter` object values can be arrays of `string`, `number`, `boolean`, or `null` values.
4447

4548
### Namespace versus metadata filtering
4649

@@ -63,6 +66,18 @@ Both [namespaces](/vectorize/best-practices/insert-vectors/#namespaces) and meta
6366
{ "someKey": { "$ne": "hbo" } }
6467
```
6568

69+
#### `$in` operator
70+
71+
```json
72+
{ "someKey": { "$in": ["hbo", "netflix"] } }
73+
```
74+
75+
#### `$nin` operator
76+
77+
```json
78+
{ "someKey": { "$nin": ["hbo", "netflix"] } }
79+
```
80+
6681
#### Implicit logical `AND` with multiple keys
6782

6883
```json

0 commit comments

Comments
 (0)