File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
x-pack/plugins/ml/server/models/bucket_span_estimator Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -343,11 +343,21 @@ export function estimateBucketSpanFactory(
343343 filterPath : '*.*max_buckets' ,
344344 } )
345345 . then ( settings => {
346- if ( typeof settings !== 'object' || typeof settings . defaults !== 'object' ) {
346+ if ( typeof settings !== 'object' ) {
347+ reject ( 'Unable to retrieve cluster settings' ) ;
348+ }
349+
350+ // search.max_buckets could exist in default, persistent or transient cluster settings
351+ const maxBucketsSetting = ( settings . defaults ||
352+ settings . persistent ||
353+ settings . transient ||
354+ { } ) [ 'search.max_buckets' ] ;
355+
356+ if ( maxBucketsSetting === undefined ) {
347357 reject ( 'Unable to retrieve cluster setting search.max_buckets' ) ;
348358 }
349359
350- const maxBuckets = parseInt ( settings . defaults [ 'search.max_buckets' ] ) ;
360+ const maxBuckets = parseInt ( maxBucketsSetting ) ;
351361
352362 const runEstimator = ( splitFieldValues = [ ] ) => {
353363 const bucketSpanEstimator = new BucketSpanEstimator (
You can’t perform that action at this time.
0 commit comments