Start/Update elasticsearch instance with 128 embedding dims #3329
-
Hello, I just got started with Haystack not too long ago and I've been to run a simple question and answer python script and also been able to set up the UI and rest API using docker-compose. For elastic search in docker, I already set the image to "elasticsearch:7.9.1" and not the instance with countries and capitals, so that it will start an empty elasticsearch instance and I can add my documents myself. But now, whenever I want to set up anything using Elastic search as my document store, I get a series of errors. If I leave the default value for embedding_dims as 768, I get an error saying "Embedding dim. of model (128) doesn't match embedding dim. in DocumentStore (768).Specify the arg |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @heyt0pe great to hear that you started trying out Haystack! The problem that you describe should be easy to fix, let me explain how. When you initialize the document store, you can set
As an alternative, when you initialize the document store, you can pick a new name for the index, e.g.
|
Beta Was this translation helpful? Give feedback.
-
I found you needed to specify both the preferred embedding dim and to recreate_index. I think using a distinct name is a good idea no matter what. So this is what worked for me:
|
Beta Was this translation helpful? Give feedback.
Hi @heyt0pe great to hear that you started trying out Haystack! The problem that you describe should be easy to fix, let me explain how.
The problem seems to be that your ElasticsearchDocumentStore already contains an index with 768 dimensions for embedding vectors. Now, if you want to store another document in that same DocumentStore but the document has only 128 dimensions in its embedding vector, you cannot store it in the same index. It's a mismatch. The number of dimensions is of the document's embedding vector depends on the model that is chosen to embed the documents. This model is set in the retriever node.
What you need to do whenever you change that model and therefore in some c…