From fe450759f70b47f7b9c7e6ee64bf7dbc40bb8aef Mon Sep 17 00:00:00 2001 From: Patricia Cobelli Date: Tue, 25 Oct 2022 16:15:33 -0300 Subject: [PATCH] Added toubleshooting case --- TROUBLESHOOTING.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index b904c31..ccbedb3 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -38,7 +38,9 @@ es_indices = es.list_indices() db_indices = Query(ElasticSearchIndexModel).get() ``` -`es_indices` and `db_indices` should be the same. If they aren't, you can delete the index from Elasticsearch and add it again to the database. +`es_indices` and `db_indices` should be the same. + +If the index is on Elasticsearch but not in the database, delete it from Elasticsearch and try again. ```python from vectory.es.client import ElasticKNNClient @@ -47,6 +49,15 @@ es = ElasticKNNClient() es.delete_index(INDEX_NAME) ``` +If the index is in the database but not on Elasticsearch, delete it from the database and try again. + +``` +from vectory.db.models import ElasticSearchIndexModel, Query + +index = Query(ElasticSearchIndexModel).get(name=INDEX_NAME)[0] +index.delete_instance(recursive=False) +``` + ## Import errors ### No module `pkg_resources`