mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #21248] [MERGED] fix: use keyword arg for IndicesClient.refresh() (opensearch-py 3.x) #41622
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21248
Author: @veeceey
Created: 2/8/2026
Status: ✅ Merged
Merged: 2/9/2026
Merged by: @tjbck
Base:
dev← Head:fix/issue-20649-opensearch-refresh-v2📝 Commits (1)
a82cea9fix: use keyword argument for IndicesClient.refresh() for opensearch-py 3.x📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
backend/open_webui/retrieval/vector/dbs/opensearch.py(+3 -3)📄 Description
Pull Request Checklist
devbranch.fix:to categorize this pull request.Changelog Entry
Description
Fixes
TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional argumentswhen using OpenSearch as vector database backend withopensearch-py >= 3.0.0. Changes the index name from positional to keyword argument in all threerefresh()calls.Supersedes #21236 (closed due to missing CLA and wrong target branch).
Fixes #20649
Changed
backend/open_webui/retrieval/vector/dbs/opensearch.py:self.client.indices.refresh(self._get_index_name(collection_name))to use keyword argument:self.client.indices.refresh(index=self._get_index_name(collection_name))refresh()calls ininsert(),upsert(), anddelete()methodsFixed
TypeErrorcrash when adding documents to knowledge base with OpenSearch backend andopensearch-py >= 3.0.0Additional Information
Root Cause
The project pins
opensearch-py==3.1.0inrequirements.txt. In opensearch-py >= 3.0.0,IndicesClient.refresh()changed its API signature: theindexparameter became keyword-only. The existing code passes it as a positional argument, causing aTypeErroron every document upload, upsert, or delete operation.All other client calls in the file (
create,delete,exists,search,get,delete_by_query) already use keyword arguments correctly. Onlyrefresh()was missed.Backward Compatibility
Using
index=keyword arg is backward-compatible withopensearch-py < 3.0.0, so this change is safe for all versions.Screenshots or Videos
Before fix:
Document upload to knowledge bases fails completely.
After fix:
Testing verification:
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.