Skip to content

Instantly share code, notes, and snippets.

@rokcarl
Created July 14, 2022 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rokcarl/467b506a1ea908d159e6c20a8925ca77 to your computer and use it in GitHub Desktop.
Save rokcarl/467b506a1ea908d159e6c20a8925ca77 to your computer and use it in GitHub Desktop.
curl -s -XPOST -H 'Content-Type: application/json' 'http://localhost:9200/stat_customers_with_keys/_search' -d '
{
"aggs": {
"0": {
"date_histogram": {
"field": "day",
"fixed_interval": "24h",
"time_zone": "Europe/Ljubljana",
"extended_bounds": {
"min": 1656626400000,
"max": 1657231200000
}
},
"aggs": {
"1": {
"sum": {
"field": "requests"
}
}
}
}
},
"size": 0,
"fields": [
{
"field": "day",
"format": "date_time"
}
],
"script_fields": {},
"stored_fields": [
"*"
],
"runtime_mappings": {},
"_source": {
"excludes": []
},
"query": {
"bool": {
"must": [],
"filter": [
{
"range": {
"day": {
"format": "strict_date_optional_time",
"gte": "2022-06-30T22:00:00.000Z",
"lte": "2022-07-07T22:00:00.000Z"
}
}
}
],
"should": [],
"must_not": []
}
}
}
' | jq '.aggregations."0".buckets[]' -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment