-
Notifications
You must be signed in to change notification settings - Fork 39
Document new error codes for vector search filtering. #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
renetapopova
merged 17 commits into
neo4j:dev
from
Lojjs:document-metadata-filtering-error-codes
Feb 6, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
27ed6ce
Document new error codes for vector search filtering.
Lojjs f6573e2
Fix copy-paste misstake
Lojjs 44c96fe
generate the index file and editorial updates
renetapopova 62c968b
Fix review comments
Lojjs a1e3abf
fix the rendering and regenerate the index file
renetapopova baadb59
Document 22NCG
Lojjs 247c340
Update status description of 42I73
Lojjs 38be86c
Update modules/ROOT/pages/errors/gql-errors/42I73.adoc
Lojjs e5ddd39
regenerate the index file
renetapopova 6d3ba03
Apply suggestion from @renetapopova
renetapopova 9320ff4
Apply suggestions from code review
Lojjs 50f2703
Align terminology with Cypher manual
Lojjs 7eb6557
Apply suggestions from code review
Lojjs 92e26d3
Align example with new status description
Lojjs 37f9ba7
regenerate the index file
renetapopova b859082
Apply suggestion from @renetapopova
renetapopova 9e3aeb5
Apply suggestion from @renetapopova
renetapopova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| = 22NCG | ||
|
|
||
| == Status description | ||
| error: data exception - wrong index type. Expected the index `{ <<idx>> }` to be a `{ <<idxType>>1 }` index but was a `{ <<idxType>>2 }` index. | ||
|
|
||
| == Example scenario | ||
| For example, assuming that you have a range index called `rangeIdx`, when trying to use it in a `SEARCH` clause: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX rangeIdx | ||
| FOR [1, 2, 3] | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS 22NCG and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: data exception - wrong index type. Expected the index `rangeIdx` to be a vector index but was a range index. | ||
| ---- | ||
|
|
||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|
|
||
| include::partial$glossary.adoc[] | ||
| endif::[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| = 22ND3 | ||
|
|
||
| == Status description | ||
| error: data exception - wrong property for vector search with filters. The property `{ <<propKey>> }` is not an additional property for vector search with filters on the vector index `{ <<idx>> }` . | ||
|
|
||
| == Example scenario | ||
| For example, assuming that you have a vector index created by the following command: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| CREATE VECTOR INDEX moviePlots | ||
| FOR (m:Movie) ON m.embedding | ||
| WITH [m.rating] | ||
| ---- | ||
|
|
||
| When using a property key other than `rating` in the `WHERE` clause property predicate in a `SEARCH` clause: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR [1, 2, 3] | ||
| WHERE movie.votes > 1000 | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS 22ND3 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: data exception - wrong property for vector search with filters. The property `votes` is not an additional property for vector search with filters on the vector index 'moviePlots'. | ||
| ---- | ||
|
|
||
| == Possible solution | ||
|
|
||
| If you want to use the property `votes` for vector search with filters, it must be added as an additional property to the vector index. | ||
| For example: | ||
|
|
||
| . Drop the index you want to add the property to: | ||
| + | ||
| [source,cypher] | ||
| ---- | ||
| DROP INDEX moviePlots | ||
| ---- | ||
|
|
||
| . Recreate the index by adding the new property to the index: | ||
| + | ||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| CREATE VECTOR INDEX moviePlots | ||
| FOR (m:Movie) ON m.embedding | ||
| WITH [m.rating, m.votes] | ||
| ---- | ||
|
|
||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|
|
||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| = 42I73 | ||
|
|
||
| == Status description | ||
| error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `{ <<expr>> }` must consist of one or more property predicates joined by `AND`, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). | ||
|
|
||
| == Example scenarios | ||
| For example, assuming that you have a vector index created by the following command: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| CREATE VECTOR INDEX moviePlots | ||
| FOR (m:Movie) ON m.embedding | ||
| WITH [m.rating] | ||
| ---- | ||
|
|
||
|
|
||
| .Using `NOT` inside the `WHERE` subclause predicate in a `SEARCH` clause | ||
| ===== | ||
| When trying to use `NOT` inside the `WHERE` subclause predicate in a `SEARCH` clause: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR [1, 2, 3] | ||
| WHERE NOT movie.rating = 8 | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title, movie.rating AS rating | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `NOT movie.rating = 8` must consist of one or more property predicates joined by AND, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). | ||
| ---- | ||
| ===== | ||
|
|
||
| .Using multiple half-bounded ranges on the same property inside the `WHERE` subclause predicate in a `SEARCH` clause | ||
| ===== | ||
| When trying to use multiple half-bounded ranges on the same property inside the `WHERE` subclause predicate in a `SEARCH` clause: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR [1, 2, 3] | ||
| WHERE movie.rating > 6 AND movie.rating > 8 | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title, movie.rating AS rating | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I73 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: syntax error or access rule violation - invalid predicate for vector search with filters. The vector search filter predicate `movie.rating > 6 AND movie.rating > 8` must consist of one or more property predicates joined by AND, and the combined property predicates for each property must specify either an exact value (e.g. `x.prop = 1`), a half-bounded range (e.g. `x.prop >= 1`), or a bounded range (e.g. `x.prop > 1 AND x.prop < 100`). | ||
| ---- | ||
| ===== | ||
|
|
||
| == Possible solution | ||
| You can rewrite the predicates to comply with the vector search filter rules. | ||
| For example, the predicate `NOT movie.rating < 7` can be rewritten to `movie.rating >= 7`, while the predicate `movie.rating > 6 AND movie.rating > 8` can be rewritten to `movie.rating > 8`. | ||
| However, it is not always possible to rewrite the predicates. | ||
| For the complete list of limitations, see link:https://neo4j.com/docs/cypher-manual/current/clauses/search/#limitations[Cypher Manual -> Limitations of the SEARCH clause]. | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|
|
||
| include::partial$glossary.adoc[] | ||
| endif::[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| = 42I74 | ||
|
|
||
| == Status description | ||
| error: syntax error or access rule violation - wrong variable for vector search with filters. The variable `{ <<variable>>1 }` in a vector search filter property predicate must be the same as the search clause binding variable `{ <<variable>>2 }`. | ||
|
|
||
| == Example scenario | ||
| For example, assuming that you have a vector index created by the following command: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| CREATE VECTOR INDEX moviePlots | ||
| FOR (m:Movie) ON m.embedding | ||
| WITH [m.rating] | ||
| ---- | ||
|
|
||
| When trying to use a variable other than `movie` inside the `WHERE` subclause predicate in a `SEARCH` clause in the following query: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (m:Movie {title:'Matrix, The'}) | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR m.embedding | ||
| WHERE m.rating >= 8 | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title, movie.rating AS rating | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I74 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: syntax error or access rule violation - wrong variable for vector search with filters. The variable `m` in a vector search filter property predicate must be the same as the search clause binding variable `movie`. | ||
| ---- | ||
|
|
||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|
|
||
| include::partial$glossary.adoc[] | ||
| endif::[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| = 42I75 | ||
|
|
||
| == Status description | ||
| error: syntax error or access rule violation - self-referencing in vector search. The expression `{ <<expr>> }` in the search clause may not depend on the search clause binding variable `{ <<variable>> }`. | ||
|
|
||
| == Example scenarios | ||
| For example, assuming that you have a vector index created by the following command: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| CREATE VECTOR INDEX moviePlots | ||
| FOR (m:Movie) ON m.embedding | ||
| WITH [m.rating] | ||
| ---- | ||
|
|
||
| .Using the search binding variable in the `FOR` subclause of a vector search | ||
| ===== | ||
| When trying to use the search binding variable `movie` in the `FOR` subclause in the following query: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR movie.embedding | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title, movie.rating AS rating | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I75 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: syntax error or access rule violation - self-referencing in vector search. The expression `movie.embedding` in the search clause may not depend on the search clause binding variable `movie`. | ||
| ---- | ||
| ===== | ||
|
|
||
| .Using the search binding variable in the `WHERE` subclause of a `SEARCH` clause | ||
| ===== | ||
| When trying to use the search binding variable `movie` in both the left-hand and right-hand side of the predicate in the `WHERE` subclause in the following query: | ||
|
|
||
| [source,cypher] | ||
| ---- | ||
| CYPHER 25 | ||
| MATCH (m:Movie {title:'Matrix, The'}) | ||
| MATCH (movie:Movie) | ||
| SEARCH movie IN ( | ||
| VECTOR INDEX moviePlots | ||
| FOR m.embedding | ||
| WHERE movie.rating = movie.year | ||
| LIMIT 5 | ||
| ) | ||
| RETURN movie.title AS title, movie.rating AS rating | ||
| ---- | ||
|
|
||
| You will receive an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001] with a cause with GQLSTATUS 42I75 and status description: | ||
|
|
||
| [source] | ||
| ---- | ||
| error: syntax error or access rule violation - self-referencing in vector search. The expression `movie.year` in the search clause may not depend on the search clause binding variable `movie`. | ||
| ---- | ||
| ===== | ||
|
|
||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|
|
||
| include::partial$glossary.adoc[] | ||
| endif::[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.