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

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

📋 Pull Request Information

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

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


📝 Commits (1)

  • dba45e5 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

Summary

  • Fixes TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments when using OpenSearch as vector database backend
  • Changes the index name from positional to keyword argument in all three refresh() calls

Root Cause

The project pins opensearch-py==3.1.0 in requirements.txt. In opensearch-py >= 3.0.0, IndicesClient.refresh() changed its API signature: the index parameter became keyword-only. The existing code passes it as a positional argument, causing a TypeError on every document upload, upsert, or delete operation.

Changes

- self.client.indices.refresh(self._get_index_name(collection_name))
+ self.client.indices.refresh(index=self._get_index_name(collection_name))

Applied to all 3 refresh() calls in:

  • 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 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


🔄 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/21236 **Author:** [@veeceey](https://github.com/veeceey) **Created:** 2/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-20649-opensearch-refresh-kwarg` --- ### 📝 Commits (1) - [`dba45e5`](https://github.com/open-webui/open-webui/commit/dba45e5c6226e5e2253f232f32dc322403645f46) 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 ## Summary - Fixes `TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments` when using OpenSearch as vector database backend - Changes the index name from positional to keyword argument in all three `refresh()` calls ## Root Cause The project pins `opensearch-py==3.1.0` in `requirements.txt`. In opensearch-py >= 3.0.0, `IndicesClient.refresh()` changed its API signature: the `index` parameter became keyword-only. The existing code passes it as a positional argument, causing a `TypeError` on every document upload, upsert, or delete operation. ## Changes ```diff - self.client.indices.refresh(self._get_index_name(collection_name)) + self.client.indices.refresh(index=self._get_index_name(collection_name)) ``` Applied to all 3 `refresh()` calls in: - `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 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 --- <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:12 -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#41612