Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created August 11, 2020 15:58
Show Gist options
  • Save nik9000/49b629051622e1e53155e56524211163 to your computer and use it in GitHub Desktop.
Save nik9000/49b629051622e1e53155e56524211163 to your computer and use it in GitHub Desktop.
$ curl -HContent-Type:application/json -uelastic:password localhost:9200/_search?pretty -d'{
> "size": 0,
> "query": {
> "range": {
> "TMAX": {
> "gt": -90,
> "lt": 50
> }
> }
> },
> "aggs": {
> "temp": {
> "variable_width_histogram": {
> "field": "TMAX",
> "buckets": 5
> },
> "aggs": {
> "station": {
> "terms": {
> "field": "station.name"
> }
> }
> }
> }
> }
> }'
{
"took" : 6816,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"temp" : {
"buckets" : [
{
"min" : -77.19999694824219,
"key" : -43.619792881032744,
"max" : -46.0,
"doc_count" : 3668,
"station" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 2379,
"buckets" : [
{
"key" : "AMUNDSEN-SCOTT",
"doc_count" : 503
},
{
"key" : "VOSTOK",
"doc_count" : 202
},
{
"key" : "LATA",
"doc_count" : 119
},
{
"key" : "OJMJAKON",
"doc_count" : 83
},
{
"key" : "AMGA",
"doc_count" : 79
},
{
"key" : "EUREKA",
"doc_count" : 72
},
{
"key" : "CURAPCA",
"doc_count" : 60
},
{
"key" : "UST-NERA",
"doc_count" : 60
},
{
"key" : "SEGEN-KYUEL",
"doc_count" : 56
},
{
"key" : "POKROVSKAJA",
"doc_count" : 55
}
]
}
},
{
"min" : -46.0,
"key" : -19.35492876676092,
"max" : -13.5,
"doc_count" : 197372,
"station" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 194990,
"buckets" : [
{
"key" : "S.A.N.A.E. AWS",
"doc_count" : 347
},
{
"key" : "POND INLET CLIMATE",
"doc_count" : 290
},
{
"key" : "ALERT CLIMATE",
"doc_count" : 270
},
{
"key" : "CAM FOUR",
"doc_count" : 258
},
{
"key" : "POND INLET",
"doc_count" : 249
},
{
"key" : "GJOA HAVEN",
"doc_count" : 227
},
{
"key" : "CAMBRIDGE BAY GSN",
"doc_count" : 196
},
{
"key" : "EUREKA",
"doc_count" : 187
},
{
"key" : "RESOLUTE CS",
"doc_count" : 182
},
{
"key" : "GJOA HAVEN CLIMATE",
"doc_count" : 176
}
]
}
},
{
"min" : -13.5,
"key" : 3.8308638421827137,
"max" : 12.550000190734863,
"doc_count" : 4339028,
"station" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 4330351,
"buckets" : [
{
"key" : "NEWPORT",
"doc_count" : 2339
},
{
"key" : "JACKSON",
"doc_count" : 1545
},
{
"key" : "SILVERTON",
"doc_count" : 961
},
{
"key" : "UTSIRA FYR",
"doc_count" : 689
},
{
"key" : "HOT SPRINGS",
"doc_count" : 615
},
{
"key" : "MARQUETTE",
"doc_count" : 566
},
{
"key" : "ALPINE",
"doc_count" : 561
},
{
"key" : "ASHLAND",
"doc_count" : 517
},
{
"key" : "FAIRFIELD",
"doc_count" : 498
},
{
"key" : "QASIGIANNGUIT HELI.",
"doc_count" : 386
}
]
}
},
{
"min" : 12.550000190734863,
"key" : 24.40705233609,
"max" : 41.29999923706055,
"doc_count" : 8950269,
"station" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 8932220,
"buckets" : [
{
"key" : "JACKSON",
"doc_count" : 3273
},
{
"key" : "NEWPORT",
"doc_count" : 2724
},
{
"key" : "ASHLAND",
"doc_count" : 2637
},
{
"key" : "LEXINGTON",
"doc_count" : 2545
},
{
"key" : "MARSHALL",
"doc_count" : 1787
},
{
"key" : "HILLSBORO",
"doc_count" : 1339
},
{
"key" : "ALPINE",
"doc_count" : 1110
},
{
"key" : "COLUMBUS",
"doc_count" : 989
},
{
"key" : "BRISBANE AERO",
"doc_count" : 826
},
{
"key" : "SILVERTON",
"doc_count" : 819
}
]
}
},
{
"min" : 41.29999923706055,
"key" : 43.748667582448576,
"max" : 49.900001525878906,
"doc_count" : 41165,
"station" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 38679,
"buckets" : [
{
"key" : "MAKKAH/MECCA",
"doc_count" : 336
},
{
"key" : "WADI AL DAWASIR",
"doc_count" : 302
},
{
"key" : "BILMA",
"doc_count" : 293
},
{
"key" : "SHARURAH",
"doc_count" : 263
},
{
"key" : "FAHUD (AUT)",
"doc_count" : 260
},
{
"key" : "IBRI",
"doc_count" : 227
},
{
"key" : "IRAN SHAHR",
"doc_count" : 213
},
{
"key" : "KUWAIT INTERNATIONA",
"doc_count" : 204
},
{
"key" : "DEATH VALLEY",
"doc_count" : 200
},
{
"key" : "TOUAT CHEIKH SIDI MOHAMED BEL",
"doc_count" : 188
}
]
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment