ES 数组 实现聚合

来源:互联网 发布:螺钿鱼骨项链淘宝网 编辑:程序博客网 时间:2024/06/05 02:38
ES array  实现聚合 


第一步 mapping 配置
{
    "mappings": {
        "addata_index": {
            "properties": {
                "host": {
                    "index": "not_analyzed",
                    "type": "string"
                }
            }
        }
    }
}


第二步 导入数据


导入数据 格式 为:


{
"host":["bmw.com.cn","baidu.com"]
}


查询 聚合


"aggs":{
"host":{
terms{
"field":"host"
}
}
}
原创粉丝点击