http://stackoverflow.com/questions/30111258/elasticsearch-in-equivalent-operator-in-elasticsearch
Similar to what Chris suggested as a comment, the analogous replacement for IN is the terms filter (queries imply scoring, which may improve the returned order).
SELECT * FROM table WHERE id IN (1, 2, 3);
The equivalent Elasticsearch filter would be:
{
"query" : {
"filtered" : {
"filter" : {
"terms" : {
"id" : [1, 2, 3] }
}
}
}
}
本文介绍了如何在 Elasticsearch 中实现 SQL 的 IN 操作符功能。通过使用 terms 过滤器来替代 SQL 中的 IN 语法,可以有效地进行多值匹配,并可能改善返回结果的排序。
1213

被折叠的 条评论
为什么被折叠?



