简体   繁体   English

在elasticsearch中处理不是最简单的方法是什么?

[英]what is simplest way to handle not in elasticsearch?

In last few months I have developed mix panel application in rails,That collecting data from mobile application,And based on mobile application I have two kind of index witch contain user profiles and user event,In user profile index I collect user profile data like name, email, phone number ... and in user events index I only collect some specific action that user done in mobile app like "app open", "sign up" and .... In my app I use elastic search as search engine.AS result of bushiness requirement I have to separate these two index to two different index and inserted in elastic search.在过去的几个月里,我在 Rails 中开发了混合面板应用程序,从移动应用程序收集数据,基于移动应用程序,我有两种索引,包含用户配置文件和用户事件,在用户配置文件索引中,我收集用户配置文件数据,如姓名,电子邮件,电话号码......在用户事件索引中,我只收集用户在移动应用程序中完成的一些特定操作,如“应用程序打开”、“注册”和......在我的应用程序中,我使用弹性搜索作为搜索引擎.AS 业务要求的结果我必须将这两个索引分离为两个不同的索引并插入弹性搜索。 Every things was fine till I found When mix panel admin login and want to search over elastic search data search result was wrong.一切都很好,直到我发现当混合面板管理员登录并想要搜索弹性搜索数据时搜索结果是错误的。 As i explain before for every mobile users I have two indexes that contain profile and event ,I use profile id in profile indexes to search over data And I have to add profile id is unique in both profile and event indexes so with profile Id I could find user event, so every user must have profile and at least have one event indexes in my design that admin could found that user data, the problem is one profile have not event, let's me explain.正如我之前为每个移动用户解释的那样,我有两个包含配置文件和事件的索引,我在配置文件索引中使用配置文件 ID 来搜索数据并且我必须添加配置文件 ID 在配置文件和事件索引中都是唯一的,因此我可以使用配置文件 ID找到用户事件,所以每个用户都必须有个人资料,并且在我的设计中至少有一个事件索引,管理员可以找到用户数据,问题是一个个人资料没有事件,让我解释一下。 suppose mobile application admin decide to generate profile for bushiness user so we have profile in our system that not have any event so when mix panel admin want to find profile that not have any event elastic return no data, In other word if admin want to find profile from event indexes elastic return no data because it's impossible event exist without profile.In my scenario I have at least two query to search over elastic search, and I know about nested query and parent-child query in elastic search but it's impossible as reason of time cost and query performance.假设移动应用程序管理员决定为商务用户生成配置文件,因此我们的系统中有没有任何事件的配置文件,所以当混合面板管理员想要找到没有任何事件的配置文件时,弹性返回没有数据,换句话说,如果管理员想要找到来自事件索引弹性的配置文件不返回数据,因为没有配置文件就不可能存在事件。在我的场景中,我至少有两个查询要搜索弹性搜索,我知道弹性搜索中的嵌套查询和父子查询,但这是不可能的原因时间成本和查询性能。 so dose any one have any idea how could I handle my issues with min changes in query.I have to add i use bool query and term query as default query for my elastic search.因此,任何人都知道如何通过查询的最小更改来处理我的问题。我必须添加我使用布尔查询和术语查询作为弹性搜索的默认查询。

You can check _msearch query .您可以检查_msearch查询

By using it you can a send single query to elasticsearch and get responses from both indices and merge them in the application.通过使用它,您可以向 elasticsearch 发送单个查询,并从两个索引中获取响应并将它们合并到应用程序中。 But elasticsearch will send multiple requests internally anyway.但是elasticsearch无论如何都会在内部发送多个请求。 Here is an example:这是一个例子:

GET _msearch
{ "index": "index1" }
{"query":{"term":{"field1":{"value":"some value 1"}}}}
{ "index": "index2" }
{"query":{"term":{"field2":{"value":"some value 2"}}}}

暂无
暂无

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

相关问题 弹性搜索排序的正确方法是什么? - What is the proper way to sort in elasticsearch? 使一组方法可用于多个Rails应用程序的最简单方法是什么 - What is the simplest way to make a group of methods available to several Rails applications 使用Omniauth-Facebook Gem添加个人资料图片的最简单方法是什么? - What is the simplest way to add an profile image with the Omniauth-Facebook Gem? 在Rails中将:pluck或:collect结果转换为字符串数组的最简单方法是什么? - What is simplest way to convert :pluck or :collect results to array of strings in Rails? 查看哈希中是否存在真实语句的最简单的最简单方法是什么? - What is the simplest lightest way to see if there is a true statement in a hash? 在rails中使用小胡子视图模板的最简单方法是什么? - What's the simplest way to use mustache view templates in rails? 处理提醒电子邮件的正确方法是什么? - What is the proper way to handle reminder emails? 在Rails模式中启用UUID的最简单的最小特权方法是什么? - What's the simplest least-privilege way to enable UUIDs in a Rails schema? 允许用户拖放表行以更改其顺序的最简单方法是什么? - What is the simplest way to allow a user to drag and drop table rows in order to change their order? 在Rails中对字符串字段的一部分进行SQL查询的最简单方法是什么? - What is the simplest way to order results from a SQL query on part of a string field in Rails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM