
Amazon DynamoDB Vector Search Inline Filters Now Support Range Comparisons, IN, Attribute Existence, and OR / NOT, So I Tried Them Out
This page has been translated by machine translation. View original
Introduction
On November 20, 2026, inline filters for Amazon DynamoDB vector search began supporting range comparisons, value lists, attribute existence checks, and logical operators.
Inline filters are a feature that narrows down items by attribute conditions written in the search condition expression (SearchConditionExpression) of SearchVectors. DynamoDB applies the filter during the search. In this article, I try the newly added operators with synthetic data and show how to write search conditions and what results were returned.
Test environment
- Region: Tokyo (ap-northeast-1)
- AWS CLI: 2.42.1
- Table: InlineFilterProducts (on-demand)
- Table key: ProductId (String, HASH)
- Vector index: ProductFilterIndex (4 dimensions, COSINE)
- Index partition key (HASH in SearchSchema): Category
- Data: 36 synthetic items (24 with Category Electronics, 12 with Apparel)
- Items with Discount: 12 of 36 (8 of 24 in Electronics)
- Search target: items whose Category is Electronics
Creating the table and index
Attributes used for filtering are declared as INLINE_FILTER in SearchSchema when the index is created. Save the index definition to the following file.
[
{
"IndexName": "ProductFilterIndex",
"VectorAttribute": {"AttributeName": "Embedding"},
"SearchSchema": [
{"AttributeName": "Category", "SearchSchemaElementType": "HASH"},
{"AttributeName": "Brand", "SearchSchemaElementType": "INLINE_FILTER"},
{"AttributeName": "Genre", "SearchSchemaElementType": "INLINE_FILTER"},
{"AttributeName": "Price", "SearchSchemaElementType": "INLINE_FILTER"},
{"AttributeName": "Rating", "SearchSchemaElementType": "INLINE_FILTER"},
{"AttributeName": "PublishedDate", "SearchSchemaElementType": "INLINE_FILTER"},
{"AttributeName": "Discount", "SearchSchemaElementType": "INLINE_FILTER"}
],
"Projection": {"ProjectionType": "ALL"},
"Dimensions": 4,
"DistanceFunction": "COSINE"
}
]
Attributes written in SearchSchema must also be declared in AttributeDefinitions. The following command declares the 7 SearchSchema attributes in addition to ProductId, the table key.
aws dynamodb create-table \
--table-name InlineFilterProducts \
--attribute-definitions \
AttributeName=ProductId,AttributeType=S \
AttributeName=Category,AttributeType=S \
AttributeName=Brand,AttributeType=S \
AttributeName=Genre,AttributeType=S \
AttributeName=Price,AttributeType=N \
AttributeName=Rating,AttributeType=N \
AttributeName=PublishedDate,AttributeType=N \
AttributeName=Discount,AttributeType=N \
--key-schema AttributeName=ProductId,KeyType=HASH \
--billing-mode PAY_PER_REQUEST \
--vector-indexes file://vector-indexes.json
Item write format
Embedding is written as a list (L) of numbers (N). The following is one PutRequest, for P003 which has Discount, from the file passed to batch-write-item.
{
"PutRequest": {
"Item": {
"ProductId": {"S": "P003"},
"Category": {"S": "Electronics"},
"Title": {"S": "Sample product 003"},
"Brand": {"S": "CirqueFit"},
"Genre": {"S": "camera"},
"Price": {"N": "152.62"},
"Rating": {"N": "4.8"},
"PublishedDate": {"N": "20260201"},
"Discount": {"N": "10"},
"Embedding": {
"L": [
{"N": "-0.7027"},
{"N": "-0.5389"},
{"N": "-0.5799"},
{"N": "-0.9951"}
]
}
}
}
}
Start searching after confirming that the index has become ACTIVE. This time, it was ACTIVE when I checked 21 seconds after creation started.
Basic form of a search
Save the query vector in the following file.
[{"N": "0.3"}, {"N": "-0.2"}, {"N": "0.8"}, {"N": "0.1"}]
The command to search for items with a Rating of 4.5 or higher is as follows.
aws dynamodb search-vectors \
--table-name InlineFilterProducts \
--index-name ProductFilterIndex \
--search-vector file://query-vector.json \
--top-k 24 \
--search-condition-expression "Category = :c AND Rating >= :v" \
--expression-attribute-values '{":c":{"S":"Electronics"},":v":{"N":"4.5"}}' \
--projection-expression "ProductId, Brand, Genre, Price, Rating, PublishedDate, Discount"
The condition on Category, which is specified as HASH in SearchSchema, is placed at the top level of the expression with = and connected to other conditions with AND.
This command returned 5 items. The SearchResults in the response contains elements with a typed Item and a Score. The first one is shown below.
{
"Item": {
"Brand": {
"S": "AcmeRun"
},
"Discount": {
"N": "10"
},
"Genre": {
"S": "camera"
},
"Price": {
"N": "127.22"
},
"ProductId": {
"S": "P015"
},
"PublishedDate": {
"N": "20250119"
},
"Rating": {
"N": "4.6"
}
},
"Score": 0.797802209854126
}
Searching by operator
I ran searches by changing the condition part of Category = :c AND <condition>, and the table shows only the condition part. TopK was set to 24, the total number of Electronics items. In every condition, the number of items and the IDs returned matched the matching items I calculated from the data at hand.
Range comparisons
For range comparisons, use the inequality operators and BETWEEN. Dates (PublishedDate) are stored as a Number in yyyymmdd format.
| Condition | Value | Items returned | Notes |
|---|---|---|---|
Price < :v |
50 | 6 | |
Price <= :v |
48.68 | 6 | Includes P023, which has the boundary value 48.68 |
Price > :v |
150 | 4 | |
Rating >= :v |
4.5 | 5 | Includes P007, which has the boundary value 4.5 |
Rating BETWEEN :lo AND :hi |
4.0 to 4.5 | 7 | Includes P020, P011, and P022 (4.0) and P007 (4.5), which have the boundary values |
PublishedDate >= :v |
20260101 | 12 |
Value lists
In the parentheses of IN, list value placeholders. The expression and values when searching for items whose Brand is AcmeRun or BravoStep are as follows. 8 items were returned.
--search-condition-expression "Category = :c AND Brand IN (:b1, :b2)" \
--expression-attribute-values '{":c":{"S":"Electronics"},":b1":{"S":"AcmeRun"},":b2":{"S":"BravoStep"}}'
Attribute existence
Of the 24 Electronics items, 8 have Discount, and 4 of those have the value 10. I compared attribute_exists / attribute_not_exists and <> on the same data.
| Condition | Items returned | Notes |
|---|---|---|
attribute_exists(Discount) |
8 | All items that have Discount |
attribute_not_exists(Discount) |
16 | All items that do not have it |
Discount <> :d (:d is 10) |
20 | The 16 items without it, plus 4 items whose value is not 10 |
attribute_exists(Discount) AND Discount <> :d (:d is 10) |
4 | The 4 items whose value is not 10 |
Because <> also matched items without Discount, I excluded them by adding attribute_exists with AND.
Combining conditions
OR is enclosed in parentheses and connected to the Category condition with AND. The last 2 rows of the table are expressions corresponding to the retail example in the announcement (price range and brand group) and the RAG example (category group and publication date condition). In the RAG example, IN cannot be used with Category, which is specified as HASH, so I narrowed down by Genre instead of Category.
| Condition | Value | Items returned | Notes |
|---|---|---|---|
(Brand = :b1 OR Brand = :b2) |
AcmeRun, DeltaGear | 11 | |
NOT Brand = :b |
CirqueFit | 14 | |
(Rating >= :r OR Price < :p) |
4.5 / 20 | 8 | |
Price BETWEEN :lo AND :hi AND Brand IN (:b1, :b2, :b3) |
50 to 130 / AcmeRun, DeltaGear, CirqueFit | 11 | Retail example from the announcement |
Genre IN (:g1, :g2) AND PublishedDate >= :d |
audio, camera / 20260101 | 7 | RAG example from the announcement |
Constraints and limits
The attribute types usable with each operator, the conditions on the attribute specified as HASH, and the limit on inline filter attributes are described in the SearchConditionExpression reference and the quotas page.
Summary
I confirmed that, in addition to the conventional narrowing by equality (=), inline filters for DynamoDB vector search can now use range comparisons, IN, attribute existence checks, and OR / NOT in SearchConditionExpression.
If you are currently filtering DynamoDB vector search results on the application side, try inline filters using the newly added operators.
