Index: bootstrap/css/bootstrap-theme.css =================================================================== diff -u -r51eb3538a6e85e190c09411a6484dac92f1ce351 -r0fe4a61a2d1efcdab7fa9234da65218242fd9d12 --- bootstrap/css/bootstrap-theme.css (.../bootstrap-theme.css) (revision 51eb3538a6e85e190c09411a6484dac92f1ce351) +++ bootstrap/css/bootstrap-theme.css (.../bootstrap-theme.css) (revision 0fe4a61a2d1efcdab7fa9234da65218242fd9d12) @@ -485,73 +485,69 @@ }; var config; - $(function() { - var queryString = null; $.getJSON("request.json", function (reqdata) { console.log(reqdata.query.bool.filter[0].bool.should[0].match["beat.hostname"]); reqdata.query.bool.filter[0].bool.should[0].match["beat.hostname"] = "9eb75e7e6e3e"; - queryString = JSON.stringify(reqdata); + var queryString = JSON.stringify(reqdata); console.log(queryString); - }); - var url = ""; - var type = ""; - if($(location).attr('port') == 9999){ - url = "/api/elasticsearch/topbeat/search/api.json"; - type = "get"; - }else{ - url="/elasticsearch/topbeat-*/_search"; - type = "get"; - } + var url = ""; + var type = ""; + if($(location).attr('port') == 9999){ + url = "/api/elasticsearch/topbeat/search/api.json"; + type = "get"; + }else{ + url="/elasticsearch/topbeat-*/_search"; + type = "post"; + } - $.ajax({ - url : url, - type : type, - data : queryString, - dataType : 'json', - jsonp : false, - jsonpCallback : 'undefined' === typeof jsonpCallback || null == jsonpCallback ? "callback" : jsonpCallback, - timeout : 7313, - crossDomain: true, - global : true, - contentType : 'application/json', - async : false, - cache : false, - success : function(data) { + $.ajax({ + url : url, + type : type, + data : queryString, + dataType : 'json', + jsonp : false, + jsonpCallback : 'undefined' === typeof jsonpCallback || null == jsonpCallback ? "callback" : jsonpCallback, + timeout : 7313, + crossDomain: true, + global : true, + contentType : 'application/json', + async : false, + cache : false, + success : function(data) { - var chartLabels = []; - var chartData = []; + var chartLabels = []; + var chartData = []; - var filteredObj = data.aggregations[2].buckets; + var filteredObj = data.aggregations[2].buckets; - $.each(filteredObj, function(inx, obj){ - chartLabels.push(obj.key); - chartData.push(obj.doc_count); - }); + $.each(filteredObj, function(inx, obj){ + chartLabels.push(obj.key); + chartData.push(obj.doc_count); + }); - //console.log(chartLabels); - //console.log(chartData); - - config = { - type: 'radar', - data: { - labels: chartLabels, - datasets: [{ - label: 'Topbeat Chart', - data: chartData, - backgroundColor: 'rgba(0, 119, 204, 0.3)' - }] + config = { + type: 'radar', + data: { + labels: chartLabels, + datasets: [{ + label: 'Topbeat Chart', + data: chartData, + backgroundColor: 'rgba(0, 119, 204, 0.3)' + }] + } } - } - //console.log(config); - window.myRadar = new Chart(document.getElementById('canvas'), config); - } + window.myRadar = new Chart(document.getElementById('canvas'), config); + } + }); }); + + });