简体   繁体   English

在 elasticsearch 中存储搜索数据的推荐方法是什么

[英]What is the recommended way to store data for search in elasticsearch

Let's say I use Elasticsearch in my application for searching restaurants near me.假设我在我的应用程序中使用 Elasticsearch 来搜索我附近的餐馆。 I get all sorted restaurants id from Elasticsearch.我从 Elasticsearch 获得所有排序的餐厅 ID。 And using these ids, I get all data like name, location, popular menus of restaurant from RDB.使用这些 id,我可以从 RDB 获取所有数据,例如名称、位置、餐厅的热门菜单。

As you can guess, it takes some time to get data from RDB.如您所料,从 RDB 获取数据需要一些时间。 If I store all data used by application in Elasticsearch, then I can make it faster.如果我将应用程序使用的所有数据存储在 Elasticsearch 中,那么我可以让它更快。 But I'm wondering what is the recommended way to store data in Elasticsearch and what to consider for choosing it.但我想知道在 Elasticsearch 中存储数据的推荐方法是什么,以及选择它时要考虑什么。

I think there are some ways like below,我认为有一些方法如下,

  1. To store data only used for search存储仅用于搜索的数据
  2. To store all data for search and display存储所有数据以供搜索和显示

Thanks!谢谢!

This is a very interesting but very common question and normally every application needs to decide this, I can provide some data points which would help you to take a informed decision.这是一个非常有趣但非常常见的问题,通常每个应用程序都需要对此做出决定,我可以提供一些数据点来帮助您做出明智的决定。

  1. Elasticsearch is a NRT search engine and there will always be some latency when you update ES from your RDB. Elasticsearch 是一个 NRT 搜索引擎,当您从 RDB 更新 ES 时总会有一些延迟。 so some of your items which are in RDB will not be in ES and thus will not be in your search results.因此,您在 RDB 中的某些项目不会在 ES 中,因此不会出现在您的搜索结果中。
  2. Considering above, why you want to make a call again to RDB, to fetch the latest info from your RDB, on your ES search result or some other reasons like avoid fetching/storing the large data from ES?考虑到上述情况,为什么要再次调用 RDB,从 RDB 中获取最新信息,在 ES 搜索结果中或其他一些原因,例如避免从 ES 中获取/存储大数据?
  3. With every field ES provides a way to store it or not using store param or using _source enabled by default, if both are not enabled, you can't fetch the actual value, then you have to go to RDB.每个字段 ES 都提供了一种存储或不使用存储参数或使用_source默认启用的方法,如果两者都未启用,则无法获取实际值,则必须将 go 转至 RDB。
  4. RDB call to fetch the values of fields put a penalty on performance, have you benchmark it versus fetching the values directly from ES.获取字段值的 RDB 调用会降低性能,您是否对它进行了基准测试,而不是直接从 ES 获取值。

Every search system has its own functional and non-functional requirement and based on above points, hope you got more information, which will help you take a better decision.每个搜索系统都有自己的功能和非功能需求,基于以上几点,希望您能得到更多信息,这将有助于您做出更好的决定。

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

相关问题 什么是在BlackBerry上存储(外部)和读取数据的推荐方法? - What's the recommended way to store (externally) and read data on a BlackBerry? 使用ES存储大数据并创建即时搜索的最佳方法是什么? - What is the best way to store big data and create instant search with ES? 存储版本控制的数据库数据的标准/推荐方法是什么? - What are the standard/recommended ways to store version-controlled, database data? 在Oracle中建议加密的方法是什么? - What is the recommended way to encrypt in Oracle? 存储和搜索复杂数字数据的方式有哪些? - What are the ways to store and search complex numeric data? 在 postgresql 中存储 json 数据的更好方法是什么? - What is the better way to store json data in postgresql? 没有关系存储数据的最佳方法是什么? - What's the best way to store data with no relation? 存储栅格数据的好方法是什么? - What's a good way to store raster data? 在 Postgres 中存储矢量数据的有效方法是什么? - What is an efficient way to store vector data in Postgres? 使用 Mongoose 删除索引的推荐方法是什么? - What is the recommended way to drop indexes using Mongoose?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM