VectorSearchFilter.filter serializes as null causing HTTP 400 from AI Core API
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 43
- Forks
- 22
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 59
Description
Describe the Problem/Bug
When using VectorApi.search(), the VectorSearchFilter class has a filter field annotated with @JsonProperty("filter") but without @JsonInclude(JsonInclude.Include.NON_NULL). When filter is not set (the
common case), it serializes as "filter": null in the JSON request body.
The AI Core API rejects this with HTTP 400:
{"error": {"code": "400", "message": "None is not valid under any of the given schemas - 'filters.0.filter'"}}
Steps to Reproduce
var filter = VectorSearchFilter.create()
.id(UUID.randomUUID().toString())
.collectionIds(List.of("*"))
._configuration(VectorSearchConfiguration.create().maxDocumentCount(5));
var request = TextSearchRequest.create()
.query("some query")
.filters(filter);
vectorApi.search(resourceGroupId, request); // → HTTP 400
Actual request body sent:
{
"query": "some query",
"filters": [{
"id": "...",
"collectionIds": ["*"],
"configuration": {"maxDocumentCount": 5},
"collectionMetadata": [],
"documentMetadata": [],
"chunkMetadata": [],
"filter": null
}]
}
Expected Behavior
filter should be omitted from the serialized JSON when not set, either via @JsonInclude(JsonInclude.Include.NON_NULL) on the field, or by configuring the SDK's default ObjectMapper with
NON_NULL inclusion.
Workaround: Construct the VectorApi with a custom ApiClient using an ObjectMapper configured with JsonInclude.Include.NON_NULL.
Screenshots
No response
Used Versions
SDK version: 1.19.0
Spring AI version: 1.1.5
Code Examples
// Your code here
Stack Trace
No response
Log File
Log file
...Affected Development Phase
Getting Started
Impact
No Impact
Timeline
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with VectorSearchFilter and inspect how its filter field is serialized, then compare the default ApiClient ObjectMapper with the custom NON_NULL workaround described in the issue. Reproduce the VectorApi.search() request and confirm that an unset filter is omitted and the AI Core API no longer returns HTTP 400.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100