Hi!
I would like to get help with custom plugin development.
I want to reference the "key" inside the filter object from the controller.
Below is my filter object.
{"meta":{"index":"raw-arm-*","key":"robot_name","value":"test1","disabled":false,"negate":false,"alias":null,"apply":true},"query":{"match":{"robot_name":{"query":"test2","type":"phrase"}}},"$state":{"store":"appState"}},
{"meta":{"index":"raw-arm-*","key":"parts_name","value":"test2","disabled":false,"negate":false,"alias":null,"apply":true},"query":{"match":{"parts_name":{"query":"test2","type":"phrase"}}},"$state":{"store":"appState"}}]
However, when I reference the key as filter[0].meta.key , it returns nothing. But I am reference index.
Below is my code snippet.
// Import module for kibana
import uiModules from 'ui/modules';
// Import d3.js module
import * as d3 from 'd3';
// Pass the plugin name
const module = uiModules.get('sample', []);
// A unique name that defines the controller name
// We are not using the aggregation provided by Kibana interfac3
module.controller('PluginController', function ($scope, timefilter, getAppState, Private, $http, $location, dateFilter) {
$scope.state = getAppState();
$scope.$watch('state.$newFilters', function (filters) {
// Do nothing when the filter was not specified at all
//if(!filters) return;
// Example of getting time range
var range_min = timefilter.getBounds().min;
var range_max = timefilter.getBounds().max;
// Flag to decide the target index is arm(0) or run-jump(1)
var target = 0
// Variable to store query
var body = '';
$scope.meta = filters[0].meta;
$scope.index = filters[0].meta.index;
$scope.type = typeof(filters[0].meta);
// I tried both to see in template but both returned nothing.
//$scope.key = filters[0].meta.key;
//$scope.key = filters[0].meta["key"];
How I can reference the key key
Thanks,
Yu