主页 >> 程序猿的东西 >> elasticsearch 查询样例

elasticsearch 查询样例

聚合查询并设置返回的数据量,该语句查询在某话题下发图数量最多的前50人。

GET /images/_search
{
    "query": {
        "bool": {
            "must": [
               {
                   "match_phrase": {
                       "content.topic": "#点赞#"
                    }
               },
               ...
            ]
        }
    },
    "aggregations" : {
        "users" : {
            "terms" : {
                "field": "user_id",
                "size": 50
            }
        }
    }
}

 

发表评论