【发布时间】:2014-03-13 08:50:15
【问题描述】:
我是弹性搜索的新手,这是我在我的集合中查找完全匹配的查询。
{
"query": {
"filtered": {
"query": {
"match": {
"_id": {
"query": "1"
}
}
},
"filter": {
"term" : {
"team_id":"2",
"created_user":"099"
}
}
}
}
}
通过运行此查询,我得到了一条记录,但我的问题是它与“team_id”字段不匹配。当我将 team_id 更改为其他值时,例如:4,我仍然得到 team_id = 2 的记录,请帮助我编写一个包含三个字段的弹性搜索查询。谢谢
【问题讨论】:
-
如果您的
_id字段是唯一的,您的查询将始终返回一个查询。你是说Give me the result that has _id=1。可能,这将返回一个结果,然后过滤该结果没有意义。如果您解释一下您要做什么,那就更好了 -
@HüseyinBABAL 感谢您的快速回复,我是弹性搜索的新手,我在 mysql 方式中的要求是 select * from message where id = 1 and team_id = 2 and created_user = 099
-
如果您在现实世界中解释您的请求(而不是弹性搜索方式),我们可以更好地帮助您
标签: node.js elasticsearch amazon-elastic-beanstalk