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] New Platform server shim: update data visualizer routes to use new platform router #56739

Merged
merged 8 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/ml/common/util/job_utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ export function processCreatedBy(customSettings: { created_by?: string }): void;
export function mlFunctionToESAggregation(functionName: string): string | null;

export function isModelPlotEnabled(job: Job, detectorIndex: number, entityFields: any[]): boolean;

export function getSafeAggregationName(fieldName: string, index: number): string;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

// Builds the base filter criteria used in queries,
// adding criteria for the time range and an optional query.
export function buildBaseFilterCriteria(timeFieldName, earliestMs, latestMs, query) {
export function buildBaseFilterCriteria(
timeFieldName?: string,
earliestMs?: number,
latestMs?: number,
query?: object
) {
const filterCriteria = [];
if (timeFieldName && earliestMs && latestMs) {
filterCriteria.push({
Expand All @@ -34,7 +39,7 @@ export function buildBaseFilterCriteria(timeFieldName, earliestMs, latestMs, que
// Wraps the supplied aggregations in a sampler aggregation.
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
// of less than 1 indicates no sampling, and the aggs are returned as-is.
export function buildSamplerAggregation(aggs, samplerShardSize) {
export function buildSamplerAggregation(aggs: object, samplerShardSize: number) {
if (samplerShardSize < 1) {
return aggs;
}
Expand All @@ -53,6 +58,6 @@ export function buildSamplerAggregation(aggs, samplerShardSize) {
// depending on whether sampling is being used.
// A supplied samplerShardSize (the shard_size parameter of the sampler aggregation)
// of less than 1 indicates no sampling, and an empty array is returned.
export function getSamplerAggregationsResponsePath(samplerShardSize) {
export function getSamplerAggregationsResponsePath(samplerShardSize: number): string[] {
return samplerShardSize > 0 ? ['sample'] : [];
}
Loading