Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: remove os data as part of reset (#1983)

Edwin Jose0d19e8329485
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 889096700..83db6c74f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -262,6 +262,8 @@ make clear-os-data # Clear OpenSearch data directory completely
make factory-reset # Complete reset: containers, volumes, and data
```
+The reset also removes any legacy `opensearch-data` directory, so old OpenSearch index files do not linger after cleanup.
+
---
## Makefile Help System
diff --git a/Makefile b/Makefile
index b565f9d09..7ebd6d17b 100644
--- a/Makefile
+++ b/Makefile
@@ -591,6 +591,7 @@ factory-reset: ## Complete reset (stop, remove volumes, clear data, remove image
echo " - Delete langflow-data directory"; \
echo " - Delete config directory"; \
echo " - Delete data directory (database and session configs)"; \
+ echo " - Delete opensearch-data directory (legacy OpenSearch bind-mount data)"; \
echo " - Delete JWT keys (private_key.pem, public_key.pem)"; \
echo " - Remove OpenRAG images"; \
echo ""; \
@@ -621,6 +622,14 @@ factory-reset: ## Complete reset (stop, remove volumes, clear data, remove image
rm -rf data; \
echo "$(PURPLE)data removed$(NC)"; \
fi; \
+ if [ -d "opensearch-data" ]; then \
+ echo "Removing opensearch-data..."; \
+ if rm -rf opensearch-data; then \
+ echo "$(PURPLE)opensearch-data removed$(NC)"; \
+ else \
+ echo "$(RED)Warning: Failed to remove opensearch-data (check permissions)$(NC)"; \
+ fi; \
+ fi; \
if [ -n "$$OPENRAG_DATA_PATH" ] && [ -d "$$OPENRAG_DATA_PATH" ]; then \
echo "Removing $$OPENRAG_DATA_PATH..."; \
rm -rf "$$OPENRAG_DATA_PATH"; \
diff --git a/docs/docs/_partial-factory-reset-warning.mdx b/docs/docs/_partial-factory-reset-warning.mdx
index c1e11894e..711a76bbf 100644
--- a/docs/docs/_partial-factory-reset-warning.mdx
+++ b/docs/docs/_partial-factory-reset-warning.mdx
@@ -4,6 +4,7 @@ This is a destructive operation that does the following:
* Destroys all OpenRAG containers, volumes, and local images.
* Prunes any additional container objects.
* Deletes the contents of the `~/.openrag` directory _except_ for OpenRAG's `.env` file and the `/documents` subdirectory.
+* Removes any legacy `opensearch-data` directory so old index data does not survive a reset.
<p/>Destroyed containers and deleted data are lost and cannot be recovered after running this operation.
:::
@@ -19,4 +20,4 @@ Neither <br/> nor wrapping the entire line in <p> </p> worked consistently for b
Either the line break was missing or the indentation was incorrect.
This behavior was observed in Docusaurus 3.9.2 on 05 Dec 2025. In a future release, if this is not longer an issue, you can remove the tag and this note. :)
--->
\ No newline at end of file
+-->