From f87b7672658e891444a3928617a80c89398a70a4 Mon Sep 17 00:00:00 2001 From: Spencer Date: Mon, 11 Feb 2019 17:18:19 -0800 Subject: [PATCH] [ftr/services/es] use apiVersion from es plugin (#30733) --- .../core_plugins/elasticsearch/index.js | 3 ++- .../elasticsearch/lib/default_api_version.js | 20 +++++++++++++++++++ test/common/services/es.js | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/legacy/core_plugins/elasticsearch/lib/default_api_version.js diff --git a/src/legacy/core_plugins/elasticsearch/index.js b/src/legacy/core_plugins/elasticsearch/index.js index 70583783e0cd8..53781932adf3e 100644 --- a/src/legacy/core_plugins/elasticsearch/index.js +++ b/src/legacy/core_plugins/elasticsearch/index.js @@ -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(), diff --git a/src/legacy/core_plugins/elasticsearch/lib/default_api_version.js b/src/legacy/core_plugins/elasticsearch/lib/default_api_version.js new file mode 100644 index 0000000000000..5b7d77e29c71e --- /dev/null +++ b/src/legacy/core_plugins/elasticsearch/lib/default_api_version.js @@ -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'; diff --git a/test/common/services/es.js b/test/common/services/es.js index 73e6ccb6a63aa..e56b86b86710a 100644 --- a/test/common/services/es.js +++ b/test/common/services/es.js @@ -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'), });