查询:
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"bool": {
"must": [
{
"match_phrase": {
"rep_date": {
"query": "2017-11-29",
"slop": 0,
"boost": 1
}
}
},
{
"match_phrase": {
"project_id": {
"query": 6164,
"slop": 0,
"boost": 1
}
}
},
{
"match_phrase": {
"domain": {
"query": "com.book2345.reader",
"slop": 0,
"boost": 1
}
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [
"domain",
"SUM"
],
"excludes": []
},
"stored_fields": "domain",
"aggregations": {
"domain": {
"terms": {
"field": "domain",
"size": 200,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_term": "asc"
}
]
},
"aggregations": {
"SUM(bid)": {
"sum": {
"field": "bid"
}
}
}
}
}
}
查询结果
{
"took" : 9,
"timed_out" : false,
"_shards" : {
"total" : 24,
"successful" : 24,
"failed" : 0
},
"hits" : {
"total" : 6,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"domain" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "com.book2345", ————————————被拆分成两个字段
"doc_count" : 6,
"SUM(bid)" : {
"value" : 743366.0
}
},
{
"key" : "reader",
"doc_count" : 6,
"SUM(bid)" : {
"value" : 743366.0
}
}
]
}
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"bool": {
"must": [
{
"match_phrase": {
"rep_date": {
"query": "2017-11-29",
"slop": 0,
"boost": 1
}
}
},
{
"match_phrase": {
"project_id": {
"query": 6164,
"slop": 0,
"boost": 1
}
}
},
{
"match_phrase": {
"domain": {
"query": "com.book2345.reader",
"slop": 0,
"boost": 1
}
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [
"domain",
"SUM"
],
"excludes": []
},
"stored_fields": "domain",
"aggregations": {
"domain": {
"terms": {
"field": "domain",
"size": 200,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_term": "asc"
}
]
},
"aggregations": {
"SUM(bid)": {
"sum": {
"field": "bid"
}
}
}
}
}
}
查询结果
{
"took" : 9,
"timed_out" : false,
"_shards" : {
"total" : 24,
"successful" : 24,
"failed" : 0
},
"hits" : {
"total" : 6,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"domain" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "com.book2345", ————————————被拆分成两个字段
"doc_count" : 6,
"SUM(bid)" : {
"value" : 743366.0
}
},
{
"key" : "reader",
"doc_count" : 6,
"SUM(bid)" : {
"value" : 743366.0
}
}
]
}
1 个回复
mafa1993
赞同来自: