ES奇技淫巧

  • 实现in操作

  1. 脚本查询:
{
    "query" : {
        "filtered" : {
          "filter" : {
            "terms" : {
              "sku" : ["10022295323","1007285302","10437642356"]
            }
          }
        }
    }
}
  1. javaAPI
BoolQueryBuilder skuTerm = QueryBuilders.boolQuery();
for(String sku : task.getSku().split(",")) {
    skuTerm.should(QueryBuilders.termQuery("sku", sku));
}

你可能感兴趣的:(ES奇技淫巧)