【发布时间】:2016-10-10 14:08:42
【问题描述】:
我有这个查询(例如“hello”)和这个 id(例如“12345”),我想搜索与“text”字段中的查询和“thread”字段中的 id 匹配的内容。但是给定的 ids 在一个数组中,所以逻辑是这样的:
function runThisQuery(query, ids) {
client.search({
index: '_all',
type: 'text',
body: {
query: {
bool: {
must: {
match: { text: query }
},
should: [
{ match: { thread: { query: ids[0], operator: 'AND'} } },
{ match: { thread: { query: ids[1], operator: 'AND'} } }
],
minimum_should_match: 1
}
}
}
})
}
如果线程在 'ids' 数组中,是否存在与线程匹配的 $in 运算符(如在 MongoDB 中)?谢谢!
【问题讨论】:
标签: json node.js mongodb elasticsearch