Skip to content

Commit

Permalink
[ftr/services/es] use apiVersion from es plugin (#30733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer authored Feb 12, 2019
1 parent 139b0d5 commit f87b767
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/legacy/core_plugins/elasticsearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand Down Expand Up @@ -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(),
Expand Down
20 changes: 20 additions & 0 deletions src/legacy/core_plugins/elasticsearch/lib/default_api_version.js
Original file line number Diff line number Diff line change
@@ -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';
3 changes: 3 additions & 0 deletions test/common/services/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
Expand Down

0 comments on commit f87b767

Please sign in to comment.