Skip to content

Instantly share code, notes, and snippets.

@trekr5
Last active August 29, 2015 14:20
Show Gist options
  • Save trekr5/5f2ff2a7f3791918a0dd to your computer and use it in GitHub Desktop.
Save trekr5/5f2ff2a7f3791918a0dd to your computer and use it in GitHub Desktop.
My elasticsearch query
client = Elasticsearch::Client.new hosts: [{host: 'localhost:9200', port: 9200}]
value = client.search index: logstash_date,
body: {
"facets"=> {
"0"=> {
"date_histogram"=> {
"field"=> "@timestamp",
"interval"=> "15m"
},
"global"=> true,
"facet_filter"=> {
"fquery"=> {
"query"=> {
"filtered"=> {
"query"=> {
"query_string"=> {
"query"=> "type:iis6 AND status:500"
}
},
"filter"=> {
"bool"=> {
"must"=> [
{
"range"=> {
"@timestamp"=> {
"from"=> "#{last_time}",
"to"=> "#{current_time}"
}
}
}
]
}
}
}
}
}
}
}
},
"size"=> 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment