赞
踩
{ "query": { "term": { "teamCityEn": { "value": "Memphis" } } }, "aggs": { "ageTerms": { "terms": { "field": "age", "size": 10 } } }, "size": 0 }
{ "query": { "term": { "teamCityEn": { "value": "Memphis" } } }, "aggs": { "ageTerms": { "terms": { "field": "age", "size": 10, "order": { "_key": "desc" (根据文档数排序则 _count) } } } }, "size": 0 }
{ "aggs": { "ageTerms": { "terms": { "field": "teamCityEn", "size": 10, "order": { "agsAge": "desc" } }, "aggs": { "agsAge": { "avg": { "field": "age" } } } } }, "size": 0 }
{ "aggs": { "ageTerms": { "terms": { "field": "teamCityEn", "include": ["Milwaukee","Dallas","Los Angeles"], "exclude": ["Miami"], "size": 10, "order": { "agsAge": "desc" } }, "aggs": { "agsAge": { "avg": { "field": "age" } } } } }, "size": 0 }
{ "aggs": { "ageRage": { "range": { "field": "age", "ranges": [ { "to": 25, "key": "黄金周期" }, { "from": 25, "to": 35, "key": "衰退期" },{ "from": 35, "key": "退役" } ] } } }, "size": 0 }
{ "aggs": { "birthDayRange":{ "date_range": { "field": "birthDay", "format": "yyyy-MM-dd", "ranges": [ { "to": "1980-01-01" }, { "from": "1980-01-01", "to": "1990-01-01" }, { "from": "1990-01-01" } ] } } }, "size": 0 }
按天、月、年等进行聚合统计。可按 year (1y), quarter (1q), month (1M), week (1w), day(1d), hour (1h), minute (1m), second (1s) 间隔聚合
{
"aggs": {
"birthDayRange":{
"date_histogram": {
"field": "birthDay",
"format": "yyyy-MM-dd",
"calendar_interval": "month"
}
}
},
"size": 0
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。