-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Add search time runtime support for index based Data Visualizer (#…
…95252) * [ML] Add runtime support from index pattern for data viz * [ML] move runtime mappings outside of aggregatableFields loop * [ML] Change arg name to runtimeMappings * [ML] Fix dv full time range broken * [ML] Fix dv broken with time range * [ML] Add better error handling/transparency * [ML] Update to using estypes.RuntimeField * [ML] Update to use some shared common functions between ml and transform * Revert "[ML] Update to use some shared common functions between ml and transform" This reverts commit ce813f0 * [ML] Disable context menu if no charts
- Loading branch information
Showing
9 changed files
with
177 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { isPopulatedObject } from './object_utils'; | ||
import { | ||
RUNTIME_FIELD_TYPES, | ||
RuntimeType, | ||
} from '../../../../../src/plugins/data/common/index_patterns'; | ||
import type { RuntimeField, RuntimeMappings } from '../types/fields'; | ||
|
||
export function isRuntimeField(arg: unknown): arg is RuntimeField { | ||
return ( | ||
isPopulatedObject(arg) && | ||
((Object.keys(arg).length === 1 && arg.hasOwnProperty('type')) || | ||
(Object.keys(arg).length === 2 && | ||
arg.hasOwnProperty('type') && | ||
arg.hasOwnProperty('script') && | ||
(typeof arg.script === 'string' || | ||
(isPopulatedObject(arg.script) && | ||
Object.keys(arg.script).length === 1 && | ||
arg.script.hasOwnProperty('source') && | ||
typeof arg.script.source === 'string')))) && | ||
RUNTIME_FIELD_TYPES.includes(arg.type as RuntimeType) | ||
); | ||
} | ||
|
||
export function isRuntimeMappings(arg: unknown): arg is RuntimeMappings { | ||
return isPopulatedObject(arg) && Object.values(arg).every((d) => isRuntimeField(d)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.