我在寻找与以下伪代码等效的代码:
SELECT id, age // works
FROM students // works
WHERE firstname = 'John' // works
AND gender = 'm' // works
AND (lastname = 'Doe' OR lastname = 'Wayne') // no idea
我当前的代码:
{
// ...
query: {
bool: {
must: [
{ match: { firstname: 'John' }},
{ match: { gender: 'm' }},
]
}
}
}
我在
OR
上苦苦挣扎。有任何想法吗?
提前致谢!
最佳答案
尝试:
{ match: { lastname: /^(Doe|Wayne)$/ }}