问题 :我有一个应用程序,只有在针对完整文档进行验证后,对文档的更改才应始终保留到 ElasticSearch 中。所以我总是要检索完整的文档!在性能方面,部分更新是否比完全更新更好?还有其他好处吗?
Elasticsearch 文档 partial update提到文档是不可变的,并且内部部分更新(如完整更新)重新索引完整文档。
Externally, it appears as though we are partially updating a document in place. Internally, however, the update API simply manages the same retrieve-change-reindex process
该文档还提到了以下内容,我认为这是“部分更新优于完全更新的好处”,但我不明白。如果分片 A 中有一个文档并且我对其进行了完整更新或部分更新,这总共是一个请求。这里的多个请求是什么意思?
The difference is that this process happens within a shard, thus avoiding the network overhead of multiple requests
最佳答案
正如你上面提到的 partial update
和 full update
使用 retrieve-change-reindex
进行更新的过程。
但不同的是:Partial Update
使用 update API
实现 retrieve-change-reindex
通过单个客户端请求,而 full update
使用 index API
需要单独的 get
和 index
requests ,这就是为什么 full update
有多个请求的网络开销。
关于Elasticsearch 部分更新与完整更新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35262818/