ES array 实现聚合
第一步 mapping 配置
{
"mappings": {
"addata_index": {
"properties": {
"host": {
"index": "not_analyzed",
"type": "string"
}
}
}
}
}
第二步 导入数据
导入数据 格式 为:
{
"host":["bmw.com.cn","baidu.com"]
}
查询 聚合
"aggs":{
"host":{
terms{
"field":"host"
}
}
}
第一步 mapping 配置
{
"mappings": {
"addata_index": {
"properties": {
"host": {
"index": "not_analyzed",
"type": "string"
}
}
}
}
}
第二步 导入数据
导入数据 格式 为:
{
"host":["bmw.com.cn","baidu.com"]
}
查询 聚合
"aggs":{
"host":{
terms{
"field":"host"
}
}
}