Can't refresh an index pattern through my plugin

(Pierre De Soyres) #1


I am developping a kibana plugin which, at some point, needs to refresh the fields of a specific index pattern.

I'm using the following code:

import uiModules from 'ui/modules';
import 'ui/courier';

var app = uiModules.get('app/myApp', ['kibana/courier']);
app.controller('myCtrl', function($scope, courier) {
    let indexPattern = courier.indexPatterns.get('myIndexPattern-*');

But, I'm getting the following error:

angular.js:12477 TypeError: FieldFormat is not a constructor
    at IndexedArray.<anonymous> (http://localhost:5601/bundles/myApp.bundle.js?v=8467:71840:15)
    at IndexedArray.memoized [as getDefaultInstance] (http://localhost:5601/bundles/commons.bundle.js?v=8467:8156:28)
    at new IndexPattern (http://localhost:5601/bundles/myApp.bundle.js?v=8467:71386:90)
    at Object.IndexPatternsProvider.self.make (http://localhost:5601/bundles/myApp.bundle.js?v=8467:71072:13)
    at Object.IndexPatternsProvider.self.get (http://localhost:5601/bundles/myApp.bundle.js?v=8467:71068:48)

Indeed, when I debug application, I can see that the property fieldformats is empty in _index_patterns.js. This makes the fieldFormats.getDefaultInstance() method fail : At line 79 of field_formats.js, the code let FieldFormat = self.byId[]; returns Undefined.

Do I miss something in order to use indexPatterns in my plugin ?

I use Kibana 5.x branch

Kibanaプラグインで FieldFormat is not a constructor エラー
(Spencer Alger) #2

You probably just need to include the default field formatters:

import 'ui/stringify/register';

(Pierre De Soyres) #3

You're right, it works with this import.

Thank you.

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.