diff --git a/panels/table/module.js b/panels/table/module.js
index e80c2eb0fcb..ac655bec370 100644
--- a/panels/table/module.js
+++ b/panels/table/module.js
@@ -24,9 +24,11 @@ angular.module('kibana.table', [])
$scope.set_listeners = function(group) {
eventBus.register($scope,'time',function(event,time) {
+ $scope.panel.offset = 0;
set_time(time)
});
eventBus.register($scope,'query',function(event,query) {
+ $scope.panel.offset = 0;
$scope.panel.query = query;
$scope.get_data();
});
@@ -55,11 +57,25 @@ angular.module('kibana.table', [])
broadcast_fields();
}
+ $scope.toggle_details = function(row) {
+ row.kibana = row.kibana || {};
+ row.kibana.details = !row.kibana.details ? $scope.without_kibana(row) : false;
+ }
+
$scope.page = function(page) {
$scope.panel.offset = page*$scope.panel.size
$scope.get_data();
}
+ $scope.build_search = function(field, value) {
+ var query = field + ":" + "\"" + addslashes(value.toString()) + "\"";
+ var glue = $scope.panel.query != "" ? " AND " : "";
+ $scope.panel.query = $scope.panel.query + glue + query;
+ $scope.panel.offset = 0;
+ $scope.get_data();
+ eventBus.broadcast($scope.$id,$scope.panel.group,'query',$scope.panel.query);
+ }
+
$scope.get_data = function() {
// Make sure we have everything for the request to complete
if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time))
@@ -88,13 +104,22 @@ angular.module('kibana.table', [])
}
$scope.panel.error = false;
$scope.hits = results.hits.total;
- $scope.data = results.hits.hits;
+ $scope.data = []
+ _.each(results.hits.hits, function(v,k) {
+ $scope.data.push(flatten_json(v['_source']))
+ })
$scope.all_fields = get_all_fields(results);
broadcast_fields();
});
}
+ $scope.without_kibana = function (row) {
+ row = _.clone(row)
+ delete row.kibana
+ return row
+ }
+
// Broadcast a list of all fields. Note that receivers of field array
// events should be able to receive from multiple sources, merge, dedupe
// and sort on the fly if needed.
diff --git a/scripts/load.sh b/scripts/load.sh
index 935f82ee2a4..77bcaa83f48 100755
--- a/scripts/load.sh
+++ b/scripts/load.sh
@@ -13,8 +13,12 @@ curl -XPUT http://localhost:9200/_template/shakespeare -d '
"play_name" : {"type": "string", "index" : "not_analyzed" },
"line_id" : { "type" : "integer", "index": "not_analyzed" },
"speech_number" : { "type" : "integer", "index": "not_analyzed" },
- "state" : {"type": "string", "index" : "not_analyzed" },
- "country" : {"type": "string", "index" : "not_analyzed" }
+ "geo" : {
+ "properties": {
+ "state" : {"type": "string", "index" : "not_analyzed" },
+ "country" : {"type": "string", "index" : "not_analyzed" }
+ }
+ }
}
}
}
diff --git a/scripts/reader.js b/scripts/reader.js
index f38ad4e838a..a5c0c5fe385 100644
--- a/scripts/reader.js
+++ b/scripts/reader.js
@@ -24,10 +24,12 @@ fs.readFile('shakespeare.json', 'utf8', function (err,data) {
var randomnumber=Math.floor(Math.random()*57600000)
var command = {index:{_index: "shakespeare", _type: "line", _id: i}};
o['@timestamp'] = new Date((new Date()).getTime() -9000000 + randomnumber);
- o.geo = [getRandomInRange(-90, 90, 3),getRandomInRange(-180, 180, 3)]
- o.country = get_country();
- if(o.country == 'US')
- o.state = get_state()
+ o.geo = {
+ geojson : [getRandomInRange(-90, 90, 3),getRandomInRange(-180, 180, 3)],
+ country : get_country()
+ }
+ if(o.geo.country == 'US')
+ o.geo.state = get_state();
console.log(JSON.stringify(command))
console.log(JSON.stringify(o));
var percent = Math.floor((i/lines)*100)