[PR #21239] [CLOSED] fix: use keyword arg for IndicesClient.refresh() (opensearch-py 3.x) #41615

Closed
opened 2026-04-25 13:47:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21239
Author: @veeceey
Created: 2/7/2026
Status: Closed

Base: devHead: fix/issue-20649-opensearch-refresh-kwarg


📝 Commits (1)

  • 06ffb9b fix: 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

  • Target branch: Verify that the pull request targets the dev branch.
  • Description: Provided below.
  • Testing: Verified the API signature change in opensearch-py 3.x documentation and source code.
  • Code review: Self-reviewed.

Changelog Entry

Description

In opensearch-py >= 3.0.0 (pinned at 3.1.0 in requirements.txt), IndicesClient.refresh() changed its API signature: the index parameter became keyword-only. The existing code passes it as a positional argument, causing TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given on every document upload, upsert, or delete operation with the OpenSearch vector database backend.

Fixed

  • Changed self.client.indices.refresh(self._get_index_name(collection_name)) to self.client.indices.refresh(index=self._get_index_name(collection_name)) in all three calls:
    • insert() method (after bulk indexing)
    • upsert() method (after bulk upsert)
    • delete() method (after bulk delete / delete_by_query)

Test Results

Before fix:

open-webui | ERROR | open_webui.routers.retrieval:process_file:1792 - IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given

Document upload to knowledge bases with OpenSearch backend fails completely.

After fix:

# Verified the API signature in opensearch-py 3.1.0
from opensearchpy import OpenSearch
import inspect
sig = inspect.signature(OpenSearch().indices.refresh)
# refresh(*, index=None, ...) -- index is keyword-only

All other client calls in the file (create, delete, exists, search, get, delete_by_query) already use keyword arguments correctly. Only refresh() was missed.

Fixes #20649

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.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/21239 **Author:** [@veeceey](https://github.com/veeceey) **Created:** 2/7/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/issue-20649-opensearch-refresh-kwarg` --- ### 📝 Commits (1) - [`06ffb9b`](https://github.com/open-webui/open-webui/commit/06ffb9b1dcbd3c1dfac5767b81168765e88c5941) fix: use keyword argument for IndicesClient.refresh() for opensearch-py 3.x ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/vector/dbs/opensearch.py` (+3 -3) </details> ### 📄 Description # Pull Request Checklist - [x] **Target branch:** Verify that the pull request targets the `dev` branch. - [x] **Description:** Provided below. - [x] **Testing:** Verified the API signature change in opensearch-py 3.x documentation and source code. - [x] **Code review:** Self-reviewed. # Changelog Entry ### Description In `opensearch-py >= 3.0.0` (pinned at `3.1.0` in `requirements.txt`), `IndicesClient.refresh()` changed its API signature: the `index` parameter became keyword-only. The existing code passes it as a positional argument, causing `TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given` on every document upload, upsert, or delete operation with the OpenSearch vector database backend. ### Fixed - Changed `self.client.indices.refresh(self._get_index_name(collection_name))` to `self.client.indices.refresh(index=self._get_index_name(collection_name))` in all three calls: - `insert()` method (after bulk indexing) - `upsert()` method (after bulk upsert) - `delete()` method (after bulk delete / delete_by_query) ## Test Results **Before fix:** ``` open-webui | ERROR | open_webui.routers.retrieval:process_file:1792 - IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given ``` Document upload to knowledge bases with OpenSearch backend fails completely. **After fix:** ```python # Verified the API signature in opensearch-py 3.1.0 from opensearchpy import OpenSearch import inspect sig = inspect.signature(OpenSearch().indices.refresh) # refresh(*, index=None, ...) -- index is keyword-only ``` All other client calls in the file (`create`, `delete`, `exists`, `search`, `get`, `delete_by_query`) already use keyword arguments correctly. Only `refresh()` was missed. Fixes #20649 ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 13:47:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#41615