0

According to the Kibana documentation I can access elasticsearch as a service and run custom queries.

I tried to do this in my own plugin (generated with the template kibana plugin service), but angularjs does not recognize 'es' or 'esAdmin' as a valid service.

The exception looks like:

Uncaught Error: [$injector:modulerr] Failed to instantiate module kibana due to:
Error: [$injector:modulerr] Failed to instantiate module esAdmin due to:
Error: [$injector:nomod] Module 'esAdmin' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.7/$injector/nomod?p0=esAdmin

What I try to do is the following:

uiModules.get('kibana', ['esAdmin', 'es'])
.run(function (esAdmin, es) {
  es.ping()
  .then(
    () => {console.log("es pinged");}
   ).catch(err => {
     console.log(err);
   });

});

What should I import or do to be able to use this service?

geujv
  • 223
  • 1
  • 4
  • 11

1 Answers1

0

I committed two errors:

  1. esAdmin and es are not modules so I don't need to inject them as angular module dependency
  2. I was missing the modules autoload import: import 'ui/autoload/modules';

After that, it is working.

geujv
  • 223
  • 1
  • 4
  • 11