简体   繁体   English

在哪里存储搜索索引的数据?

[英]Where to store data for a search index?

I'm building a search index (Elasticsearch) for existing data in a relational database. 我正在为关系数据库中的现有数据构建搜索索引(Elasticsearch)。 Is it common to have duplicated in both the relational database as well as the search index? 在关系数据库和搜索索引中都重复是否常见? Or should it just be the search index? 还是应该只是搜索索引? How safe is it to have your data stored entirely on say the Elasticsearch cloud? 将数据完全存储在Elasticsearch云中有多安全?

It's a common pattern to have data in both systems: 在两个系统中都有数据是一种常见的模式:

  • datastore: source of truth. 资料储存库:真相来源。 Only used for CRUD 仅用于CRUD
  • search engine: Where all queries are sent 搜索引擎:所有查询都发送到哪里

If you can afford some data loss (depending on your use case) in very corner cases, then having only data in elasticsearch could be ok. 如果在极端情况下可以承担一些数据丢失(取决于您的用例),那么只在Elasticsearch中使用数据就可以了。

I recommend reading carefully this page: https://www.elastic.co/guide/en/elasticsearch/resiliency/current/index.html 我建议您仔细阅读以下页面: https : //www.elastic.co/guide/en/elasticsearch/resiliency/current/index.html

I Would recommend keeping both the RDBMS as a storage and Index file of Elastic Search to have data. 我建议同时将RDBMS保留为Elastic Search的存储和索引文件,以获取数据。

You can run reindexing of the Elastic search every day at midnight to keep the data up to date. 您可以每天在午夜运行Elastic搜索的重新索引编制,以使数据保持最新。

If the Index file corrupts, you still have data in RDBMS, which can be used to rebuild the index later. 如果索引文件损坏,则RDBMS中仍然有数据,以后可用于重建索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM