Skip to content

feat: add search level to Milvus AutoIndex - #876

Merged
jamesgao-jpg merged 2 commits into
zilliztech:mainfrom
yanbinyang:codex/milvus-autoindex-level
Sep 20, 2026
Merged

jamesgao-jpg merged 2 commits into
zilliztech:mainfrom
yanbinyang:codex/milvus-autoindex-level

Conversation

@yanbinyang

@yanbinyang yanbinyang commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #875. Milvus AutoIndex supports an optional search level on compatible deployments, but VectorDBBench did not expose it through its configuration or CLI. As a result, CLI and YAML runs could not reproduce or record level-specific AutoIndex searches.

I added an optional level field to AutoIndexConfig and exposed it through milvusautoindex as --level, or level in YAML, with validation from 1 through 10. The search parameter includes the level only when it is configured, so omitting the option preserves the server default and index creation remains unchanged. The FLAT command now uses a separate option type so milvusflat does not accept an AutoIndex-only parameter.

Added a CLI unit test that verifies the configured level reaches the Milvus AutoIndex case configuration. A live search-only run on a level-capable Milvus deployment also reproduced the previous recall across all eight Cohere and BioASQ cases at 1M and 10M, each with K=10 and K=100.

Signed-off-by: YangYanbin <warlock.yyb@alibaba-inc.com>
@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yanbinyang
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yanbinyang

Copy link
Copy Markdown
Contributor Author

/assign @XuanYang-cn

Hi, when you have time, could you please take a look? The workflow is awaiting maintainer approval. Thanks!

@jamesgao-jpg jamesgao-jpg left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

I think the idea is good, but if you have some free time, it will be really great if we can fix zilliz's autoindex together with this pr.

  1. Unify the search-level entry point with Zilliz Cloud: make zilliz_cloud/config.py's AutoIndexConfig a thin subclass of the renewed Milvus AutoIndexConfig so both providers share one level field and its 1–10 validation, while keeping Zilliz's level=1 default / always-send behavior so existing zillizautoindex runs and result files are unchanged. ZillizCloudFtsConfig stays on MilvusFtsConfig with its own level: int = 1. This warrants a refactor but I will do it later.

  2. Share the CLI option as a TypedDict fragment so zillizautoindex --level gets the same IntRange(1,10) validation (it is currently type=str with a manual int() conversion).

  3. Add regression coverage for the omitted-level and milvusflat-rejects---level contracts, plus out-of-range rejection.

  4. README placement nit + note that zillizautoindex shares --level.

Thanks in advance!


class AutoIndexConfig(MilvusIndexConfig, DBCaseConfig):
index: IndexType = IndexType.AUTOINDEX
level: int | None = Field(default=None, ge=1, le=10)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parity suggestion: Zilliz Cloud already has its own AutoIndexConfig with a separate level: int = 1 (zilliz_cloud/config.py:30), and zillizautoindex --level is type=str with no range check. Consider making the Zilliz class a thin subclass of this one (class AutoIndexConfig(MilvusAutoIndexConfig)) so both providers share one level field + the 1–10 validation, keeping Zilliz's level=1 default and always-send search_param() so existing zillizautoindex runs/results are unchanged. Boundary: ZillizCloudFtsConfig must stay on MilvusFtsConfig (BM25/sparse machinery) with its own level: int = 1 — it must not inherit this dense config.

@yanbinyang yanbinyang Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in aac8019: Zilliz Cloud AutoIndexConfig now subclasses the Milvus AutoIndex config and shares the same constrained level type. Its default remains 1 and the inherited search_param still always sends it. ZillizCloudFtsConfig remains on MilvusFtsConfig.


class MilvusAutoIndexTypedDict(CommonTypedDict, MilvusTypedDict): ...
class MilvusAutoIndexTypedDict(CommonTypedDict, MilvusTypedDict):
level: Annotated[

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this option into a shared TypedDict fragment (same pattern as HNSWFlavor3 / IVFFlatTypedDictN in vectordb_bench/cli/cli.py) so zillizautoindex reuses the same --level definition. Zilliz's current --level is type=str with a manual int() conversion — non-numeric input crashes with a traceback and out-of-range values pass through unvalidated — while click.IntRange(1, 10) rejects both cleanly.

@yanbinyang yanbinyang Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in aac8019: extracted a shared AutoIndexLevelTypedDict with click.IntRange(1, 10). Both milvusautoindex and zillizautoindex reuse it, and the Zilliz manual string-to-int conversion has been removed.

Comment thread tests/test_milvus_zilliz_cli.py Outdated
)

assert result.exit_code == 0, result.output
assert captured["db_case_config"].level == 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set-path coverage only. The PR's two backward-compat claims are untested: (1) omitted --level → level is None and search_param() has no params key (server default preserved); (2) milvusflat rejects --level (the stated reason for the MilvusFlatTypedDict split). Suggest sibling assertions for the omitted case, the MilvusFlat --level rejection, and out-of-range --level 0 / 11.

@yanbinyang yanbinyang Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in aac8019: added focused coverage for omitted Milvus level/no params, milvusflat rejecting --level, and Milvus rejecting out-of-range values 0 and 11.

Comment thread README.md Outdated
<other options>
```

`milvusautoindex` accepts `--level` from 1 to 10 (YAML: `level`) on servers that

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this paragraph sits inside the --note-file discussion right after a zillizautoindex example. Suggest moving it next to a milvusautoindex example, and (if the Zilliz subclass suggestion lands) noting that zillizautoindex shares the same --level (1–10).

@yanbinyang yanbinyang Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in aac8019: moved the level documentation next to a milvusautoindex example and documented the shared 1-10 range plus the different omitted-value behavior for Milvus and Zilliz Cloud.

Reuse the validated AutoIndex level contract across Milvus and Zilliz Cloud, add focused compatibility regression coverage, and clarify the CLI defaults in the README.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6-astra
AI-Contributed/Feature: 84/84
AI-Contributed/UT: 44/44

Signed-off-by: YangYanbin <warlock.yyb@alibaba-inc.com>
@yanbinyang
yanbinyang force-pushed the codex/milvus-autoindex-level branch from 9b7aa59 to aac8019 Compare September 16, 2026 09:15
@yanbinyang

Copy link
Copy Markdown
Contributor Author

Hi @jamesgao-jpg , I’ve addressed all review comments in aac8019 and replied inline. When convenient, could you please take another look?

@jamesgao-jpg

Copy link
Copy Markdown
Collaborator

/lgtm

@jamesgao-jpg
jamesgao-jpg merged commit a2cfcd1 into zilliztech:main Sep 20, 2026
4 checks passed
jamesgao-jpg added a commit to jamesgao-jpg/VectorDBBench that referenced this pull request Sep 21, 2026
…ge-cli

Resolve conflicts with PR zilliztech#876 (feat: add search level to Milvus AutoIndex):

- vectordb_bench/backend/clients/milvus/config.py: combine imports —
  keep Field from zilliztech#876 and field_validator from zilliztech#871.
- vectordb_bench/backend/clients/milvus/cli.py: MilvusAutoIndex now uses
  _apply_milvus_case_defaults(AutoIndexConfig(level=parameters["level"]), parameters)
  so both the search level and the force-merge defaults apply.
- tests/test_milvus_zilliz_cli.py: keep both the force-merge tests and the
  search-level tests.

Signed-off-by: jamesgao-jpg <james.gao@zilliz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow an optional search level in milvusautoindex

3 participants