How do I update metadata of Elasticsearch Document Store? #3319
-
Hi team, I am using Haystack with ElasticsearchDocumentStore in my application. My doubt is the following: I have a requirement where on user interactions, we need to update a field(say priority) in the metadata. So, is there an option in the retriever or any other way, to get the task done? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @JaisVJ you can do communicate document updates directly to your running Elasticsearch instance and don't need to use Haystack for that: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-update.html#_update_part_of_a_document For some use cases one can use the custom_query parameter in Haystack here to interact with Elasticsearch but I don't think it works for updating a document's meta data: Last but not least, what you can do is overwrite the existing document by using |
Beta Was this translation helpful? Give feedback.
Hi @JaisVJ you can do communicate document updates directly to your running Elasticsearch instance and don't need to use Haystack for that: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-update.html#_update_part_of_a_document
For some use cases one can use the custom_query parameter in Haystack here to interact with Elasticsearch but I don't think it works for updating a document's meta data:
haystack/haystack/nodes/retriever/sparse.py
Line 33 in dcb132b
Last but not least, what you can do is overwrite the existing document by using
write_documents
an…