From ebc8e81a3ff5c98608125d88c2018accf28a0f84 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 28 Sep 2026 09:40:23 +0200 Subject: [PATCH] fix: editing a knowledge file on Elasticsearch keeps its old text searchable With VECTOR_DB=elasticsearch, changing a file's content in a knowledge base added the new text but never removed the old chunks, so searches and chats kept returning the old text next to the new. The old chunks are now found and removed after the edit, the same as on the default store. Fixes #31523 --- backend/open_webui/retrieval/vector/dbs/elasticsearch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/retrieval/vector/dbs/elasticsearch.py b/backend/open_webui/retrieval/vector/dbs/elasticsearch.py index f8178bdbac..ca9eb1e08c 100644 --- a/backend/open_webui/retrieval/vector/dbs/elasticsearch.py +++ b/backend/open_webui/retrieval/vector/dbs/elasticsearch.py @@ -200,9 +200,9 @@ class ElasticsearchClient(VectorDBBase): } for field, value in filter.items(): - query_body['query']['bool']['filter'].append({'term': {field: value}}) + query_body['query']['bool']['filter'].append({'term': {f'metadata.{field}': value}}) query_body['query']['bool']['filter'].append({'term': {'collection': collection_name}}) - size = limit if limit else 10 + size = limit if limit else 10000 try: result = self.client.search(