Skip to content

Instantly share code, notes, and snippets.

@cmarat
Last active July 31, 2017 12:31
Show Gist options
  • Save cmarat/e6aabb995de70e4c3b03aa4d672618ce to your computer and use it in GitHub Desktop.
Save cmarat/e6aabb995de70e4c3b03aa4d672618ce to your computer and use it in GitHub Desktop.
Query Elasticsearch .monitoring indices for periods of time when the cluster status was red
GET .monitoring-es*/cluster_state/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"term": {
"cluster_state.status": "red"
}
},
{
"range": {
"timestamp": {
"gte": "2017-07-29T00:00:00.000Z"
}
}
}
]
}
},
"aggs": {
"red": {
"date_histogram": {
"field": "timestamp",
"interval": "day",
"min_doc_count": 1
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment