Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/content/changelogs/vectorize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ productLink: "/vectorize/"
productArea: Developer platform
productAreaLink: /workers/platform/changelog/platform/
entries:
- publish_date: "2024-11-13"
title: Added support for `$in` and `$nin` metadata filters
description: |-
Vectorize now supports `$in` and `$nin` clauses in [metadata filters](/vectorize/reference/metadata-filtering/).

- publish_date: "2024-10-28"
title: Improved query latency through REST API
description: |-
Expand Down
11 changes: 10 additions & 1 deletion src/content/docs/vectorize/reference/metadata-filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ Optional `filter` property on `query()` method specifies metadata filter:
| -------- | ----------- |
| `$eq` | Equals |
| `$ne` | Not equals |
| `$in` | In |
| `$nin` | Not in |

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

### Namespace versus metadata filtering

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

#### `$in` operator

```json
{ "someKey": { "$in": ["hbo", "netflix"] } }
```

#### Implicit logical `AND` with multiple keys

```json
Expand Down
Loading