gpt4 book ai didi

elasticsearch - Elasticsearch是否适合作为最终存储解决方案?

转载 作者:行者123 更新时间:2023-12-02 22:47:00 25 4
gpt4 key购买 nike

我目前正在学习Elasticsearch,并且我注意到很多用于修改索引的操作都需要对所有文档重新编制索引,例如向所有文档添加字段,据我所知,这意味着检索文档,执行所需的操作,删除从索引中提取原始文档,然后对其重新索引。这似乎有些危险,在执行此操作之前(显然),最好使用原始索引的备份。

这让我想知道Elasticsearch是否真的适合作为最终的存储解决方案,或者我是否应该将构成索引的原始文档分开存储,以便在必要时能够从头开始创建索引。还是定期备份索引足够安全?

最佳答案

您在这里谈论两个问题:

  • 删除旧文档并在架构更改时重新编制索引:添加新字段时,您不必总是删除旧文档。有多种选项可以更改架构。看看这个博客,其中介绍了在不停机的情况下更改架构的方法。

  • http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/

    另外,请查看Update API,它使您能够添加/删除字段。

    The update API allows to update a document based on a script provided. The operation gets the document (collocated with the shard) from the index, runs the script (with optional script language and parameters), and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure no updates have happened during the "get" and "reindex". Note, this operation still means full reindex of the document, it just removes some network roundtrips and reduces chances of version conflicts between the get and the index. The _source field need to be enabled for this feature to work.


  • 完全使用Elasticsearch作为最终存储解决方案:这取决于您打算如何将Elastic Search用作存储。您是否需要RDBMS,键值存储,基于列的数据存储或像MongoDb这样的文档存储?当您需要具有基于Lucene的高级搜索功能的分布式文档存储(json,html,xml等)时,Elastic Search绝对适合。看一下ES的各种用例,尤其是在《卫报》上的用法:http://www.elasticsearch.org/case-study/guardian/
  • 关于elasticsearch - Elasticsearch是否适合作为最终存储解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28558555/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com