Created
May 7, 2015 11:13
-
-
Save abraverm/9192b09d103b8cd1c39f to your computer and use it in GitHub Desktop.
elasticsearch dashboard
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
| /** | |
| * | |
| * Created by shelbysturgis on 1/23/14. | |
| */ | |
| define(['scripts/d3.v3', 'scripts/elasticsearch', 'scripts/c3/c3'], function (d3, elasticsearch) { | |
| "use strict"; | |
| var client = new elasticsearch.Client({ | |
| host: 'http://elasticsearch-abraverm.rhcloud.com/elasticsearch', | |
| log: 'trace' | |
| }); | |
| client.search({ | |
| index: 'bugzilla', | |
| size: 0, | |
| body: | |
| { | |
| // Begin query. | |
| query: { | |
| query_string: { | |
| query: "*", | |
| analyze_wildcard: true | |
| } | |
| }, | |
| filter: { | |
| bool: { | |
| must: [ | |
| { | |
| range: { | |
| "@timestamp": { | |
| gte: 925506000000, | |
| lte: 942848565206 | |
| } | |
| } | |
| } | |
| ], | |
| must_not: [] | |
| } | |
| }, | |
| // Aggregate on the results | |
| aggs: { | |
| bydate: { | |
| date_histogram: { | |
| "field": "@timestamp", | |
| "interval": "1M", | |
| "pre_zone": "+03:00", | |
| "pre_zone_adjust_large_interval": true, | |
| "min_doc_count": 1, | |
| } | |
| } | |
| } | |
| } | |
| }).then(function (resp) { | |
| // console.log(resp); | |
| // var bugs = resp.aggregations.bydate.buckets; | |
| var chart = c3.generate({ | |
| bindto: '#chart', | |
| data: { | |
| columns: [ | |
| ['data1', 30, 200, 100, 400, 150, 250], | |
| ['data2', 50, 20, 10, 40, 15, 25] | |
| ] | |
| } | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment