ES字段聚合关闭默认分词

QueryDSL:

{
    "aggs": {
        "myagg": {
            "terms": {
                "field": "abc"
            }
        }
    }
}

更改为:

{
    "aggs": {
        "myagg": {
            "terms": {
                "field": "abc.raw"
            }
        }
    }
}

JavaAPI:

TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(fieldName).field(fieldName);
// 更改为:
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(fieldName).field(fieldName+".raw");

你可能感兴趣的:(ES字段聚合关闭默认分词)