elasticsearch聚合后进行筛选

我用该语句进行查询:{
"size": 0,
"aggs": {
"userGuidagg": {
"terms": {
"field": "userGuid","size":300
},

"aggs": {
"actions": {
"terms": { "field":"action"}
}
}
}
}
}
然后结果显示:
{
"took": 14496,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 151568981,
"max_score": 0,
"hits": []
},
"aggregations": {
"userGuidagg": {
"doc_count_error_upper_bound": 779,
"sum_other_doc_count": 131454618,
"buckets": [
{
"key": "",
"doc_count": 12449200,
"actions": {
"doc_count_error_upper_bound": 3383,
"sum_other_doc_count": 1555422,
"buckets": [
{
"key": "client.init.getConfigData",
"doc_count": 3866337
},
{
"key": "user.ev.ride.nearParks",
"doc_count": 1678314
},
{
"key": "user.ride.nearBikes",
"doc_count": 1073576
},
{
"key": "client.init.getRideConfig",
"doc_count": 868433
},
{
"key": "common.activity.page",
"doc_count": 706158
},
{
"key": "minipro.operationPos.get",
"doc_count": 693345
},
{
"key": "user.ev.ride.cityServiceAreas",
"doc_count": 653678
},
{
"key": "user.account.aliEasyLogin",
"doc_count": 647127
},
{
"key": "user.ride.parkAddr",
"doc_count": 423233
},
{
"key": "user.monthcard.config",
"doc_count": 283577
}
]
}
},
{
"key": "c65c918aa5bf4e6aa10de1116b8029a2",
"doc_count": 307578,
"actions": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "user.ride.nearBikes",
"doc_count": 307578
}
]
}
},
{
"key": "8b48e5013f2a4aa88476eaed620b0608",
"doc_count": 5541,
"actions": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "user.forbiddenArea.nearby",
"doc_count": 5538
},
{
"key": "user.account.getHomePageMessage",
"doc_count": 3
}
]
}
},
{
"key": "85151c3d13b5421c99d3d3b1bf78b652",
"doc_count": 4841,
"actions": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "user.ride.check",
"doc_count": 2873
},
{
"key": "user.account.getFundsInfo",
"doc_count": 1959
},
{
"key": "user.ride.nearBikes",
"doc_count": 2
},
{
"key": "city.serviceArea.userCityServiceArea",
"doc_count": 1
},
{
"key": "minipro.operationPos.get",
"doc_count": 1
},
{
"key": "user.activity.getActiveActivity",
"doc_count": 1
},
{
"key": "user.collect.card.canGetCard",
"doc_count": 1
},
{
"key": "user.forbiddenArea.nearby",
"doc_count": 1
},
{
"key": "user.ride.create",
"doc_count": 1
},
{
"key": "user.ride.report",
"doc_count": 1
}
]
}
},
我想对搜索的结果进行过率,例如只要包含“key”:"user.ride.cheak"的userGuid该如何写查询方法呢
已邀请:

cece

赞同来自:

使用bucket_selector 但是参数要求是数字,不符合!

xys2333 - 90

赞同来自:

聚合后过滤 post_filter  自己去官网查

cece

赞同来自:

尝试post_filter不满足要求啊
 

auroracxy

赞同来自:

官方文档,Filter Bucket
我用过这个

要回复问题请先登录注册