[ftr/services/es] use apiVersion from es plugin (#30733)

This commit is contained in:
Spencer 2019-02-11 17:18:19 -08:00 committed by GitHub
parent 139b0d512d
commit f87b767265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View file

@ -24,6 +24,7 @@ import { clientLogger } from './lib/client_logger';
import { createClusters } from './lib/create_clusters';
import { createProxy } from './lib/create_proxy';
import filterHeaders from './lib/filter_headers';
import { DEFAULT_API_VERSION } from './lib/default_api_version';
const DEFAULT_REQUEST_HEADERS = ['authorization'];
@ -57,7 +58,7 @@ export default function (kibana) {
startupTimeout: Joi.number().default(5000),
logQueries: Joi.boolean().default(false),
ssl: sslSchema,
apiVersion: Joi.string().default('master'),
apiVersion: Joi.string().default(DEFAULT_API_VERSION),
healthCheck: Joi.object({
delay: Joi.number().default(2500)
}).default(),

View file

@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export const DEFAULT_API_VERSION = 'master';

View file

@ -21,10 +21,13 @@ import { format as formatUrl } from 'url';
import elasticsearch from 'elasticsearch';
import { DEFAULT_API_VERSION } from '../../../src/legacy/core_plugins/elasticsearch/lib/default_api_version';
export function EsProvider({ getService }) {
const config = getService('config');
return new elasticsearch.Client({
apiVersion: DEFAULT_API_VERSION,
host: formatUrl(config.get('servers.elasticsearch')),
requestTimeout: config.get('timeouts.esRequestTimeout'),
});