Elasticsearch复杂查询,模仿Join查询
所以,假设我有 2 个索引用户和产品。
在用户中,我有以下格式:
users:
{
uid:"00001",
name:"Hash",
country:"US"
},
Within the products I have the following format:
product:
{
productname: "Shoes",
.
.
.
uid:"0001"
}
我的问题是,如何链接这两个索引并将其数据连接在一起?就像在 MySQL 中一样,我会执行以下操作:
SELECT * FROM users u JOIN products p ON u.uid = p.uid;
我希望结果与上面的查询相同,我的意思是这样的:
{
name:"Hash",
country:"US",
productname: "Shoes",
.
.
.
uid:"0001"
}
Elasticsearch 查询中有类似的内容吗?请帮忙!
So, let us say I have 2 indices users and products.
Within users I have the following format:
users:
{
uid:"00001",
name:"Hash",
country:"US"
},
Within the products I have the following format:
product:
{
productname: "Shoes",
.
.
.
uid:"0001"
}
My question is, how I can link these 2 indices and join its data together? like in MySQL I would do the following:
SELECT * FROM users u JOIN products p ON u.uid = p.uid;
I want the result to be the same as the above query, I mean like this :
{
name:"Hash",
country:"US",
productname: "Shoes",
.
.
.
uid:"0001"
}
Is there anything similar in Elasticsearch query? please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论