fix upgrade script (bm25 nits) 
diff --git a/docs/examples/retrievers/composable_retrievers.ipynb b/docs/examples/retrievers/composable_retrievers.ipynb
index 065170a5a86f2..78d8515001303 100644
--- a/docs/examples/retrievers/composable_retrievers.ipynb
+++ b/docs/examples/retrievers/composable_retrievers.ipynb
@@ -33,11 +33,12 @@
    "outputs": [],
    "source": [
     "%pip install llama-index-storage-docstore-mongodb\n",
-    "%pip install llama-index-readers-file\n",
+    "%pip install llama-index-vector-stores-qdrant\n",
     "%pip install llama-index-storage-docstore-firestore\n",
-    "%pip install llama-index-storage-docstore-dynamodb\n",
+    "%pip install llama-index-retrievers-bm25\n",
     "%pip install llama-index-storage-docstore-redis\n",
-    "%pip install llama-index-vector-stores-qdrant"
+    "%pip install llama-index-storage-docstore-dynamodb\n",
+    "%pip install llama-index-readers-file"
    ]
   },
   {
@@ -122,7 +123,7 @@
    "outputs": [],
    "source": [
     "from llama_index.core import VectorStoreIndex, StorageContext\n",
-    "from llama_index.core.retrievers import BM25Retriever\n",
+    "from llama_index.retrievers.bm25 import BM25Retriever\n",
     "from llama_index.vector_stores.qdrant import QdrantVectorStore\n",
     "from qdrant_client import QdrantClient\n",
     "\n",
@@ -422,7 +423,7 @@
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": ".venv",
+   "display_name": "Python 3 (ipykernel)",
    "language": "python",
    "name": "python3"
   },
@@ -439,5 +440,5 @@
   }
  },
  "nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
 }
diff --git a/llama-index-core/llama_index/core/command_line/mappings.json b/llama-index-core/llama_index/core/command_line/mappings.json
index 147feef03a336..16326b162dbf6 100644
--- a/llama-index-core/llama_index/core/command_line/mappings.json
+++ b/llama-index-core/llama_index/core/command_line/mappings.json
@@ -305,7 +305,6 @@
   "RecursiveRetriever": "llama_index.core.retrievers",
   "AutoMergingRetriever": "llama_index.core.retrievers",
   "RouterRetriever": "llama_index.core.retrievers",
-  "BM25Retriever": "llama_index.core.retrievers",
   "QueryFusionRetriever": "llama_index.core.retrievers",
   "# SQLSQLRetriever": "llama_index.core.retrievers",
   "NLSQLRetriever": "llama_index.core.retrievers",
@@ -393,6 +392,7 @@
   "set_google_config": "llama_index.vector_stores.google",
   "GoogleVectorStore": "llama_index.vector_stores.google",
   "MetalVectorStore": "llama_index.vector_stores.metal",
+  "BM25Retriever": "llama_index.retrievers.bm25",
   "PathwayRetriever": "llama_index.retrievers.pathway",
   "YouRetriever": "llama_index.retrievers.you",
   "ZillizCloudPipelineIndex": "llama_index.indices.managed.zilliz",
diff --git a/llama-index-core/llama_index/core/command_line/upgrade.py b/llama-index-core/llama_index/core/command_line/upgrade.py
index 20db64956f3aa..291a53f72d62d 100644
--- a/llama-index-core/llama_index/core/command_line/upgrade.py
+++ b/llama-index-core/llama_index/core/command_line/upgrade.py
@@ -48,12 +48,16 @@ def _parse_from_imports(
                         new_imports[new_import_parent].append(module)
                 else:
                     print(f"Module not found: {module}\nSwitching to core")
+                    # get back the llama_index module that's being imported.
                     new_import_parent = (
-                        imported_modules[0]
-                        .split(" import ")[0]
-                        .split("from ")[-1]
-                        .replace("llama_index", "llama_index.core")
+                        imported_modules[0].split(" import ")[0].split("from ")[-1]
                     )
+                    # if the parent contains `llama_index.core` already, then skip
+                    if "llama_index.core" not in new_import_parent:
+                        new_import_parent = new_import_parent.replace(
+                            "llama_index", "llama_index.core"
+                        )
+
                     if new_import_parent not in new_imports:
                         new_imports[new_import_parent] = [module]
                     else:

the upgrade script isn't idempotent, and this change doesn't really fix all the issues, but it does prevent replacing modules that already have "llama_index.core" with another core (llama_index.core.core) 