Skip to content

Instantly share code, notes, and snippets.

@rokcarl

rokcarl/normal Secret

Created July 14, 2022 14:07
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/6a5db307a9dd3dac2325cf7a20165648 to your computer and use it in GitHub Desktop.
Save rokcarl/6a5db307a9dd3dac2325cf7a20165648 to your computer and use it in GitHub Desktop.
curl -s -XPOST -H 'Content-Type: application/json' 'http://localhost:9200/stats*/_search' -d '
{
"aggs": {
"0": {
"date_histogram": {
"field": "timestamp",
"fixed_interval": "24h",
"time_zone": "Europe/Ljubljana",
"extended_bounds": {
"min": 1656626400000,
"max": 1657231200000
}
}
}
},
"size": 0,
"fields": [
{
"field": "timestamp",
"format": "date_time"
}
],
"script_fields": {},
"stored_fields": [
"*"
],
"runtime_mappings": {},
"_source": {
"excludes": []
},
"query": {
"bool": {
"must": [],
"filter": [
{
"range": {
"timestamp": {
"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[] | "\(.key_as_string),\(.doc_count)"' -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment