Reviewed & tested by the community
Project:
Milvus VDB Provider
Version:
1.1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Jan 2026 at 23:17 UTC
Updated:
11 May 2026 at 16:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
paulsheldrake commentedComment #6
a.dmitriiev commentedI have created a new MR, because the original one had also some changes to the filtering, but I think it should be done in a separate issue, as this one is related to the batch indexing.
New MR follows the updated logic from parent AI Core issue. To avoid breaking changes the new method
insertBatchIntoCollectionwas added to base class. In new MR this method is implemented.Comment #7
a.dmitriiev commentedComment #8
abarrioAssing patch to be used in a project.
Comment #9
abarrioAdding it with patch extension
Comment #10
csakiistvanComment #11
csakiistvanTesting report for #3568651 — Batch inserts for improved indexing performance
Environment:
aimodule 1.2.7,ai_vdb_provider_milvus1.x-devbatching-support-44.patch)Step 1 — Apply patch and enable module
The patch from MR !44 was applied to
web/modules/contrib/ai_vdb_provider_milvus. The module was not yet enabled; enabling it also required pulling indrupal/search_api(not present in the project):Both
ai_searchandsearch_apiwere enabled as dependencies. ✅Step 2 — Verify patch contents are present
Running
patch --dry-runconfirmed the changes are already applied:Both modified files contain the expected changes:
src/MilvusV2.php—insertIntoCollection()detects batch vs. single record usingisset($data[0]) && is_array($data[0])and wraps accordingly.src/Plugin/VdbProvider/MilvusProvider.php— newinsertBatchIntoCollection()method with retry logic on error code 1100.Step 3 — Unit-level tests via drush script
Since the project uses PHPUnit 12 while Drupal 11.3 core only ships PHPUnit 11 compatibility traits, the existing
MilvusV2Testcannot currently be bootstrapped. Testing was done through adrush php:scriptwith mocked Guzzle/MilvusV2objects instead.MilvusV2 batch detection logic (2 scenarios):
MilvusProvider::insertBatchIntoCollection() (3 scenarios):
01100(content too long), then0All 10 assertions passed.
Observation: AI Core
indexItemsdoes not yet callinsertBatchIntoCollectionThis MR correctly adds
insertBatchIntoCollection()to the Milvus provider, andMilvusV2::insertIntoCollection()now handles batch payloads. However,AiVdbProviderClientBase::indexItems()in theaimodule still callsinsertIntoCollection()once per embedding in a loop:Until the AI Core base class is also updated to collect embeddings into a batch and call
insertBatchIntoCollection(), real-world indexing will still insert records one at a time. This MR lays the necessary groundwork on the Milvus side; the performance gain depends on a companion patch in theaimodule.Summary
insertBatchIntoCollectionsucceeds on code 0/200insertBatchIntoCollectionretries after 1100 (content sanitize)insertBatchIntoCollectionthrows on unknown error codeAiVdbProviderClientBase::indexItemscalls batch methodThe MR code is correct and well-structured. To complete the performance improvement, a patch to
AiVdbProviderClientBase::indexItems()in theaimodule is also needed so that embeddings are collected and flushed as a batch rather than inserted individually.Comment #12
csakiistvan