Most issues in Vectory with Elasticsearch are related to Docker. Vectory assumes you have Docker installed with Docker Compose version >=2.3.4
and that the Docker daemon is running.
You can check your version of Docker Compose by running:
docker compose version
You can follow Docker's official guide to update Docker Compose or install it altogether.
You can't have more than one instance of Vectory running at the same time. If you try to start Vectory while it's already running, you'll get an error message like this:
sqlite3.OperationalError: database is locked
Just stop the running instance of Vectory and try again.
If adding an index to the database fails in a way we haven't anticipated, it might happen that the index is loaded in Elasticsearch but not in the database. This can be checked by comparing the indices on both places:
from vectory.db.models import ElasticSearchIndexModel, Query
from vectory.es.client import ElasticKNNClient
es = ElasticKNNClient()
es_indices = es.list_indices()
db_indices = Query(ElasticSearchIndexModel).get()
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.
from vectory.es.client import ElasticKNNClient
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)
The Python module setuptools
has errors if installed with pip
or poetry
. You can fix this with:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python