Last active
August 29, 2015 14:20
-
-
Save trekr5/5f2ff2a7f3791918a0dd to your computer and use it in GitHub Desktop.
My elasticsearch query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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