Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose ES createClient to plugins #40717

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ClusterClient;
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export interface CoreSetup

| Property | Type | Description |
| --- | --- | --- |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>{</code><br/><code> adminClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> dataClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> }</code> | |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>{</code><br/><code> adminClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> dataClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> createClient: (type: string, clientConfig?: Partial&lt;ElasticsearchClientConfig&gt;) =&gt; ClusterClient;</code><br/><code> }</code> | |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>{</code><br/><code> registerOnPreAuth: HttpServiceSetup['registerOnPreAuth'];</code><br/><code> registerAuth: HttpServiceSetup['registerAuth'];</code><br/><code> registerOnPostAuth: HttpServiceSetup['registerOnPostAuth'];</code><br/><code> basePath: HttpServiceSetup['basePath'];</code><br/><code> createNewServer: HttpServiceSetup['createNewServer'];</code><br/><code> isTlsEnabled: HttpServiceSetup['isTlsEnabled'];</code><br/><code> }</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ElasticsearchConfig } from './elasticsearch_config';
import { ElasticsearchService, ElasticsearchServiceSetup } from './elasticsearch_service';

const createSetupContractMock = () => {
const setupContract: ElasticsearchServiceSetup = {
const setupContract: jest.Mocked<ElasticsearchServiceSetup> = {
legacy: {
config$: new BehaviorSubject({} as ElasticsearchConfig),
},
Expand Down
10 changes: 9 additions & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
*/

import { Observable } from 'rxjs';
import { ClusterClient, ElasticsearchServiceSetup } from './elasticsearch';
import {
ClusterClient,
ElasticsearchClientConfig,
ElasticsearchServiceSetup,
} from './elasticsearch';
import { HttpServiceSetup, HttpServiceStart } from './http';
import { PluginsServiceSetup, PluginsServiceStart } from './plugins';

Expand Down Expand Up @@ -115,6 +119,10 @@ export interface CoreSetup {
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
createClient: (
type: string,
clientConfig?: Partial<ElasticsearchClientConfig>
) => ClusterClient;
};
http: {
registerOnPreAuth: HttpServiceSetup['registerOnPreAuth'];
Expand Down
1 change: 1 addition & 0 deletions src/core/server/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
elasticsearch: {
adminClient$: deps.elasticsearch.adminClient$,
dataClient$: deps.elasticsearch.dataClient$,
createClient: deps.elasticsearch.createClient,
},
http: {
registerOnPreAuth: deps.http.registerOnPreAuth,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface CoreSetup {
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ClusterClient;
};
// (undocumented)
http: {
Expand Down