index per request #2940
-
Is your feature request related to a problem? Please describe. My data has a metadata that divides my data, so for each request I can get the data for one of them. The issue is that with a big amount of data, I would like that "x" value to be my index to make performance better. Describe the solution you'd like Currently index is a parameter for data store, so if I create a different data store for each request, I'll have to probably create a different retriever which means load the model for each request which won't be ideal. Describe alternatives you've considered I considered creating a different data store and retriever for each request but I assume it'll be very slow (correct me if I'm wrong). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, @naor-pragma thanks for asking your question. I believe you can achieve what you want without needing to create a new retriever for each document_store.
So I believe you can pass this on by specifying params = {"Retriever": {"index": YOUR_INDEX}} With these two steps you should only need one document store to contain all of your different types of data and then only need one retriever which can search through your different indices by passing the Let me know if this helps! |
Beta Was this translation helpful? Give feedback.
Hi, @naor-pragma thanks for asking your question. I believe you can achieve what you want without needing to create a new retriever for each document_store.
index
parameter in theDocumentStore.write_documents()
method. The API docs explaining the parameters can be found here: https://haystack.deepset.ai/reference/document-storeindex
parameter to theretrieve()
method of the retriever. Here are the API docs on all parameters for theRetriever.retrieve()
method https://haystack.deepset.ai/reference/retriever.So I believe you can pass this on by specifying