Send empty vector index type on Weaviate 1.37.5#341
Merged
Conversation
Mirrors weaviate-python-client#2042 for the C# client. The server now applies DEFAULT_VECTOR_INDEX when vectorIndexType is omitted; injecting "hnsw" client-side is preserved for older servers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two bugs found while testing against Weaviate 1.37.4 and 1.37.5-e0fe0d5
with DEFAULT_VECTOR_INDEX=flat:
1. Configure.Vector synthesized a fully-populated HNSW index when the
user passed no `index` argument. This made every named-vector config
land on the wire as `vectorIndexType: "hnsw"` even on 1.37.5, defeating
the server-side DEFAULT_VECTOR_INDEX mechanism. Synthesis now only
happens when the user provided a quantizer (which implies HNSW).
2. InjectLegacyDefaultVectorIndexType wrote a class-level VectorIndexType
even when the class used named vectors (VectorConfig). The server
rejects this combination ("creating a class with both a class level
vector index and named vectors is forbidden"). Top-level injection is
now guarded by VectorConfig being empty, mirroring the Go fix.
Adds integration tests using Testcontainers .NET against both server
versions to lock the behavior in place, and a focused unit test for the
named-vectors + empty-top-level case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
The integration test reads WEAVIATE_VERSION (existing convention) and adapts its assertions to the running server: on servers >= 1.37.5 we assert the server-side DEFAULT_VECTOR_INDEX=flat applies; on older servers we assert the client-injected "hnsw" landed. One container per run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This is the first server build that exposes DEFAULT_VECTOR_INDEX, which the version-aware integration test in this branch verifies end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary - Weaviate C# Client CoverageSummary
CoverageWeaviate.Client - 49.5%
Weaviate.Client.Analyzers - 0%
Weaviate.Client.VectorData - 50.3%
|
The test reads DEFAULT_VECTOR_INDEX (default "hfresh") for both the testcontainer env and the expected stored type on servers >= 1.37.5. CI sets it explicitly to "hfresh" so the value used in CI is visible in the workflow file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test
Drop the hardcoded fallback ("1.37.5-e0fe0d5.amd64") and the
arch-detection branch. CI sets the version explicitly in the workflow
env block; locally export it before running. Hardcoded version defaults
in test code rot and can mask CI/local drift.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The calling workflow's global env is not inherited by reusable workflows — the variable was silently absent from the test job. Moving it to a job-level env in test-on-weaviate-version.yml makes it available where the testcontainer integration test runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The inject step in CollectionsClient only covered the create path. The AddVector path (CollectionConfigClient.AddVectorAsync) also needs it to avoid sending an empty VectorIndexType to old servers, which reject it with 422 "unsupported vector index type". Also extract ExpectedDefaultIndexType() helper in the integration test to avoid repeating the ternary inline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ncConfig Both fields are no-ops on servers >= 1.37.3. Remove from the user-facing model, both directions of the DTO mapping, and unit tests. The generated DTO (Models.g.cs) still has the fields so old-server responses continue to deserialize cleanly — they are simply dropped during DTO-to-model mapping. Unit tests updated to use PropagationConcurrency and HashtreeHeight. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd regenerate DTO Removes the two no-op fields from openapi.json and regenerates Models.g.cs via NSwag so the DTO layer is consistent with the handwritten model and mapping code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The integration test steps were missing WEAVIATE_VERSION, causing DefaultVectorIndexTypeIntegrationTests to throw on startup. Promote it to the job env alongside DEFAULT_VECTOR_INDEX so all steps (unit and integration) see it. Remove the now-redundant inline prefix from the unit test step. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
g-despot
reviewed
May 22, 2026
|
|
||
| ### Removed | ||
|
|
||
| - **`ReplicationAsyncConfig.MaxWorkers` and `ReplicationAsyncConfig.AliveNodesCheckingFrequency`** — Both fields have been no-ops on the server since Weaviate 1.37.3 and are now removed from the user-facing model, the OpenAPI spec, and the generated DTO. Existing code that sets these properties will not compile after upgrading; no behavioral change results from the removal. |
Collaborator
There was a problem hiding this comment.
Does this also need to be removed from PublicAPI.Shipped.txt?
Contributor
Author
There was a problem hiding this comment.
Yes, when the release is cut
| /// </summary> | ||
| /// <param name="c">Action to update the collection.</param> | ||
| /// <param name="cancellationToken">Cancellation token.</param> | ||
| public async Task<CollectionConfigExport> Update( |
Collaborator
There was a problem hiding this comment.
Is the InjectLegacyVectorIndexDefault check also needed here just like above?
| /// <exception cref="WeaviateClientException"></exception> | ||
| /// <exception cref="WeaviateClientException"></exception> | ||
| /// <returns>The vector config</returns> | ||
| internal static VectorConfig MultiVector( |
Collaborator
There was a problem hiding this comment.
Might need the same index is null check as above
…y integration tests - Add InjectLegacyVectorIndexDefault check to CollectionConfigClient.Update() to match Create() behavior - Simplify DefaultVectorIndexTypeIntegrationTests to use existing IntegrationTests infrastructure instead of Testcontainers - Remove Testcontainers dependency - Add DEFAULT_VECTOR_INDEX support to all docker-compose files for integration testing - Update ci/start_weaviate.sh to set DEFAULT_VECTOR_INDEX env var - Remove redundant env vars from test-on-weaviate-version.yml workflow This addresses the PR comment about needing the InjectLegacyVectorIndexDefault check in CollectionConfigClient for consistency.
…t HNSW-specific values On Weaviate 1.37.5+, the server defaults vectorIndexType to 'hfresh' instead of 'hnsw' when no explicit index is provided. Tests that assert HNSW-specific properties (cleanupIntervalSeconds, quantizer, etc.) must now explicitly create collections with VectorIndex.HNSW to ensure consistent behavior.
ServerSideBatch_TaskHandleUuid_MatchesInserted passes locally (761ms) but times out in CI with resource constraints. Increase timeout from 10s to 30s to match other batch tests that also need more time in CI environments.
g-despot
approved these changes
May 27, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Starting with Weaviate 1.37.5 the server sets a default vector index type to set when the client does not specify one. This PR establishes that no vector index type is set by default, and only sets "hsnw" as default for servers running <=1.37.4.
Update the C# client to handle the default vector index type correctly for Weaviate versions 1.37.5 and above. Fix bugs related to vector index type defaults and add integration tests to ensure consistent behavior across server versions. The client now respects server-side defaults while maintaining compatibility with older versions.