如何实现 Java 中的条款查询?无论如何使用 termsQuery() 或其他方式?
How do I implement a terms query like under in Java? Anyway to use termsQuery() or other way?
如何实现 Java 中的条款查询?
无论如何使用 termsQuery() 或其他方式?
{
"terms": {
"model_id": [
"166168N",
"753547",
"1568357",
"90112",
"1020682",
"3257438"
],
"boost": 1.0E+6
}
}
您可以使用 Java 高级客户端创建如下查询:
SearchRequest searchRequest = new SearchRequest("userdoc");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
String[] values = new String[] { "166168N", "753547", "1568357", "90112", "1020682", "3257438" };
searchSourceBuilder.query(new TermsQueryBuilder("model_id", values).boost(1));
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
如何实现 Java 中的条款查询? 无论如何使用 termsQuery() 或其他方式?
{
"terms": {
"model_id": [
"166168N",
"753547",
"1568357",
"90112",
"1020682",
"3257438"
],
"boost": 1.0E+6
}
}
您可以使用 Java 高级客户端创建如下查询:
SearchRequest searchRequest = new SearchRequest("userdoc");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
String[] values = new String[] { "166168N", "753547", "1568357", "90112", "1020682", "3257438" };
searchSourceBuilder.query(new TermsQueryBuilder("model_id", values).boost(1));
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);