IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Elasticsearch service
editElasticsearch service
editElasticsearch service
provides elasticsearch.client
program API to communicate with Elasticsearch server HTTP API.
The Elasticsearch service is only available server side. You can use the Data plugin APIs on the client side.
elasticsearch.client
interacts with Elasticsearch service on behalf of:
-
kibana_system
user viaelasticsearch.client.asInternalUser.*
methods. -
a current end-user via
elasticsearch.client.asCurrentUser.*
methods. In this case Elasticsearch client should be given the current user credentials. See Scoped services and Security.
Elasticsearch service API docs
import { CoreStart, Plugin } from '@kbn/core/public'; export class MyPlugin implements Plugin { public start(core: CoreStart) { async function asyncTask() { const result = await core.elasticsearch.client.asInternalUser.ping(…); } asyncTask(); } }
For advanced use-cases, such as a search, use Data plugin