如何在Java端的Elasticsearch中使用子句“ include”

时间:2018-10-21 20:55:43

标签: elasticsearch

Helllo,

我使用的是Elasticsearch 6.2.3,我有一个查询,其中我使用了Include子句,以便仅接收经过过滤的值的键:

"query": { "nested" : {
"query" : {
  "match_phrase_prefix" :{
    "tags.values.value.newsuggest" : {
      "query" : "ohne",
      "slop" : 0,
      "max_expansions" : 50,
      "boost" : 1.0
    }
  }
},
"path" : "tags",
"ignore_unmapped" : false,
"score_mode" : "none",
"boost" : 1.0}},"aggs": {
"agg_name": {
  "nested": {
    "path": "tags"
  },
  "aggs": {
    "agg_name2": {
      "terms": {
        "field": "tags.values.value.facet",
        "size": 10,
        "include": "ohne.*"
      }
    }}

问题是我不知道如何在Java中使用它。 我尝试像波纹管一样,但是找不到任何水桶。

 IncludeExclude includeValue = new IncludeExclude(searchValue, null);
        agg = AggregationBuilders.nested("agg", "tags")
                .subAggregation(AggregationBuilders.terms("aggregation").field("tags.values.value.facet").size(10).includeExclude(includeValue));

0 个答案:

没有答案