kibana/docs/developer/architecture/core/elasticsearch-service.asciidoc
amyjtechwriter 6666ed4635
[DOCS] Trying to fix broken links, or removing them (#162844)
## Summary

Relates to #162551

Links returning 404 on [Elasticsearch service
page](https://www.elastic.co/guide/en/kibana/current/elasticsearch-service.html)
in the Developer guide.

Replaced the link to the data plug in and one to the global search
plugin (though I'm not sure keeping the sentence and the link to the
global search plugin is useful - maybe we should just remove both
completely). Removed the link 'Elasticsearch service API docs'
altogether.
2023-08-01 18:40:47 +01:00

28 lines
1.1 KiB
Text

[[elasticsearch-service]]
== Elasticsearch service
`Elasticsearch service` provides `elasticsearch.client` program API to communicate with Elasticsearch server HTTP API.
NOTE: The Elasticsearch service is only available server side. You can use the {kib-repo}blob/{branch}/src/plugins/data/README.mdx[Data plugin].
`elasticsearch.client` interacts with Elasticsearch service on behalf of:
- `kibana_system` user via `elasticsearch.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 <<development-security>>.
[source,typescript]
----
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 for specific objects, use the {kib-repo}blob/{branch}/x-pack/plugins/global_search/README.md[Global search plugin].