Skip to content

Commit

Permalink
[7.6] [ML] Fixes bucket span estimators loading of max_buckets setting (
Browse files Browse the repository at this point in the history
#59639) (#59662)

* [ML] Fixes bucket span estimators loading of max_buckets setting (#59639)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* fixing test

* reverting test fix

* disabling test

* disabling tests for error text

* removing tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
jgowdyelastic and elasticmachine authored Mar 10, 2020
1 parent 78508b8 commit 918cdd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 139 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,21 @@ export function estimateBucketSpanFactory(callWithRequest, elasticsearchPlugin,
filterPath: '*.*max_buckets',
})
.then(settings => {
if (typeof settings !== 'object' || typeof settings.defaults !== 'object') {
if (typeof settings !== 'object') {
reject('Unable to retrieve cluster settings');
}

// search.max_buckets could exist in default, persistent or transient cluster settings
const maxBucketsSetting = (settings.defaults ||
settings.persistent ||
settings.transient ||
{})['search.max_buckets'];

if (maxBucketsSetting === undefined) {
reject('Unable to retrieve cluster setting search.max_buckets');
}

const maxBuckets = parseInt(settings.defaults['search.max_buckets']);
const maxBuckets = parseInt(maxBucketsSetting);

const runEstimator = (splitFieldValues = []) => {
const bucketSpanEstimator = new BucketSpanEstimator(
Expand Down

0 comments on commit 918cdd4

Please sign in to comment.