嵌套字段上的聚合,嵌套字段属性上的fielddata = true

问题描述 投票:1回答:1

我有这种格式的json

{
"id":1,
"name":"CBG",
"studDetails":{
"address":"Banglore"
}
}

尝试在studDetails.address上进行汇总以获取此错误

Fielddata is disabled on text fields by default. Set fielddata=true on [studDetails.address].

在curl命令下面尝试设置为true,但不起作用。

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/student -d '{
  "mappings": {
    "type": {
      "properties": {
        "studDetails.address": {
          "type": "keyword",
          "fielddata": true
        }
      }
    }
  }
}'
elasticsearch elasticsearch-5
1个回答
0
投票

抱歉,我在聚合api'student.studDetails.address'中缺少标准路径”>

 srb.addAggregation(AggregationBuilders.nested("agg1", "studDetails").
                subAggregation(AggregationBuilders.terms("agg2").field("student.studDetails.address")));
© www.soinside.com 2019 - 2024. All rights reserved.