#GET /_cat/indices
#查看download_num的最大值分布
POST /ry_market_2_ru/_search?pretty
{
“size”: 0,
“aggs”: {
“download_num”: {
“max”: {
“field”: “download_num”
}
}
}
}
#查看download_num的百分比区间
POST /ry_market_2_ru/_search?pretty
{
“size”: 0,
“aggs”:{
“download_num”:{
“percentiles”:{
“field”: “download_num”
}
}
}
}
#查看download_num特定区间数据的比值情况
POST /ry_market_2_ru/_search?size=0
{
“aggs”:{
“download_num”:{
“percentiles”:{
“field”:“download_num”,
“percents” : [50,96,99]
}
}
}
}
#查看数据分布情况,根据downloadNum进行数据分桶操作,相当于group by操作语句。可以观察出来数据的分布情况的
POST /ry_market_2_ru/_search
{
“size”:0,
“aggs”: {
“download_num”: {
“terms”: {
“field”: “download_num”,
“size”: 100,
“order”: {
“_key”: “desc”
}
}
}
}
}
#继续查看其他的数据分布信息
POST /ry_market_2_ru/_search
{
“size”:0,
“aggs”: {
“download_num”: {
“filter”: {
“match”:{
“seo_key”:“kitty”
}
},
“aggs”: {
“download_num”: {
“terms”: {
“field”: “download_num”,
“size”: 6,
“order”: {
“_key”: “desc”
}
}
}
}
}
}
}
#数据范围分桶操作
POST /ry_market_2_ru/_search
{
“size”: 0,
“aggs”: {
“download_num_range”: {
“range”: {
“field”: “download_num”,
“keyed”: true,
“ranges”: [
{
“from”:0,
“to”:100000,
“key”:“10000”
},
{
“from”:100000,
“to”:1000000,
“key”:“1000000”
},
{
“from”:1000000,
“to”:10000000,
“key”:“10000000”
},
{
“from”:10000000,
“to”:100000000,
“key”:“100000000”
},
{
“from”:100000000,
“to”:1000000000,
“key”:“1000000000”
}
]
}
}
}
}
#查询指定范围内的数据分布情况信息
POST /ry_market_2_ru/_search
{
“size”: 0,
“aggs”: {
“download_num_range”: {
“range”: {
“field”: “download_num”,
“ranges”: [
{
“from”:1000001,
“to”:2000000,
“key”:“2000000”
},
{
“from”:2000000,
“to”:3000000,
“key”:“3000000”
},
{
“from”:3000000,
“to”:4000000,
“key”:“4000000”
},
{
“from”:4000000,
“to”:5000000,
“key”:“5000000”
},
{
“from”:5000000,
“to”:6000000,
“key”:“6000000”
},
{
“from”:6000000,
“to”:7000000,
“key”:“7000000”
},
{
“from”:7000000,
“to”:8000000,
“key”:“8000000”
},
{
“from”:8000000,
“to”:9000000,
“key”:“9000000”
},
{
“from”:9000000,
“to”:10000000,
“key”:“10000000”
}
]
}
}
}
}
#查看数据分布规律
#查询指定范围内的数据分布情况信息
POST /ry_market_2_ru/_search
{
“size”: 0,
“aggs”: {
“download_num_range”: {
“range”: {
“field”: “download_num”,
“ranges”: [
{
“from”:1000001,
“to”:10000000,
“key”:“10000000”
}
]
}
}
}
}