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

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

Merged
merged 8 commits into from
Mar 10, 2020
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

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