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

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we add i18n for this message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we generally don't translate errors thrown from the server side, none of the other errors thrown by the bucketspan estimator are translated nor are errors in other services like the data recogniser.
This might be an oversight and we should be translating all of these, if so i would suggest we do that in a follow up PR.

}

// 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