我有这种格式的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
}
}
}
}
}'
抱歉,我在聚合api'student.studDetails.address'中缺少标准路径”>
srb.addAggregation(AggregationBuilders.nested("agg1", "studDetails").
subAggregation(AggregationBuilders.terms("agg2").field("student.studDetails.address")));