Updating a field in all records in elasticsearch

后端 未结 1 1816
梦如初夏
梦如初夏 2020-12-20 15:53

I\'m new to ElasticSearch, so this is probably something quite trivial, but I haven\'t figured out anything better that fetching everything, processing with a script and upd

相关标签:
1条回答
  • 2020-12-20 16:23

    There are a couple of open issues about making possible to update documents by query.

    The technical challenge is that lucene (the text search engine library that elasticsearch uses under the hood) segments are read only. You can never modify an existing document. What you need to do is delete the old version of the document (which by the way will only be marked as deleted till a segment merge happens) and index the new one. That's what the existing update api does. Therefore, an update by query might take a long time and lead to issues, that's why it's not released yet. A mechanism that allows to interrupt running queries would be a nice to have too for this case.

    But there's the update by query plugin that exposes exactly that feature. Just beware of the potential risks before using it.

    0 讨论(0)
提交回复
热议问题