Reputation: 2351
I have this query (e.g. 'hello') and this id (e.g. '12345') and I want to search for something that matches both the query in a 'text' field and the id in a 'thread' field. But the given ids are in an array, so the logic is something like:
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
}
}
}
})
}
Is there like an $in operator (like in MongoDB) that matches the thread if it's in the 'ids' array? Thanks!
Upvotes: 0
Views: 80