mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Transforms: Fixes chart histograms for runtime fields. (#93028)
Fixes chart histograms for runtime fields. The runtime field configurations were not passed on to the endpoint to fetch the charts data, so charts ended up being empty with a 0 documents legend.
This commit is contained in:
parent
c0535abc06
commit
8201d4fd01
22 changed files with 250 additions and 119 deletions
|
@ -53,3 +53,27 @@ export interface ResponseStatus {
|
|||
export interface CommonResponseStatusSchema {
|
||||
[key: string]: ResponseStatus;
|
||||
}
|
||||
|
||||
export const runtimeMappingsSchema = schema.maybe(
|
||||
schema.recordOf(
|
||||
schema.string(),
|
||||
schema.object({
|
||||
type: schema.oneOf([
|
||||
schema.literal('keyword'),
|
||||
schema.literal('long'),
|
||||
schema.literal('double'),
|
||||
schema.literal('date'),
|
||||
schema.literal('ip'),
|
||||
schema.literal('boolean'),
|
||||
]),
|
||||
script: schema.maybe(
|
||||
schema.oneOf([
|
||||
schema.string(),
|
||||
schema.object({
|
||||
source: schema.string(),
|
||||
}),
|
||||
])
|
||||
),
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
|
@ -7,14 +7,20 @@
|
|||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
import { ChartData } from '../shared_imports';
|
||||
|
||||
import { runtimeMappingsSchema } from './common';
|
||||
|
||||
export const fieldHistogramsRequestSchema = schema.object({
|
||||
/** Query to match documents in the index. */
|
||||
query: schema.any(),
|
||||
/** The fields to return histogram data. */
|
||||
fields: schema.arrayOf(schema.any()),
|
||||
/** Optional runtime mappings */
|
||||
runtimeMappings: runtimeMappingsSchema,
|
||||
/** Number of documents to be collected in the sample processed on each shard, or -1 for no sampling. */
|
||||
samplerShardSize: schema.number(),
|
||||
});
|
||||
|
||||
export type FieldHistogramsRequestSchema = TypeOf<typeof fieldHistogramsRequestSchema>;
|
||||
export type FieldHistogramsResponseSchema = any[];
|
||||
export type FieldHistogramsResponseSchema = ChartData[];
|
||||
|
|
|
@ -14,7 +14,7 @@ import type { PivotAggDict } from '../types/pivot_aggs';
|
|||
import type { PivotGroupByDict } from '../types/pivot_group_by';
|
||||
import type { TransformId, TransformPivotConfig } from '../types/transform';
|
||||
|
||||
import { transformStateSchema } from './common';
|
||||
import { transformStateSchema, runtimeMappingsSchema } from './common';
|
||||
|
||||
// GET transforms
|
||||
export const getTransformsRequestSchema = schema.arrayOf(
|
||||
|
@ -64,30 +64,6 @@ export const settingsSchema = schema.object({
|
|||
docs_per_second: schema.maybe(schema.nullable(schema.number())),
|
||||
});
|
||||
|
||||
export const runtimeMappingsSchema = schema.maybe(
|
||||
schema.recordOf(
|
||||
schema.string(),
|
||||
schema.object({
|
||||
type: schema.oneOf([
|
||||
schema.literal('keyword'),
|
||||
schema.literal('long'),
|
||||
schema.literal('double'),
|
||||
schema.literal('date'),
|
||||
schema.literal('ip'),
|
||||
schema.literal('boolean'),
|
||||
]),
|
||||
script: schema.maybe(
|
||||
schema.oneOf([
|
||||
schema.string(),
|
||||
schema.object({
|
||||
source: schema.string(),
|
||||
}),
|
||||
])
|
||||
),
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
export const sourceSchema = schema.object({
|
||||
runtime_mappings: runtimeMappingsSchema,
|
||||
index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]),
|
||||
|
|
|
@ -6,5 +6,9 @@
|
|||
*/
|
||||
|
||||
export type { HitsTotalRelation, SearchResponse7 } from '../../ml/common';
|
||||
export { HITS_TOTAL_RELATION } from '../../ml/common';
|
||||
export { composeValidators, patternValidator } from '../../ml/common';
|
||||
export {
|
||||
composeValidators,
|
||||
patternValidator,
|
||||
ChartData,
|
||||
HITS_TOTAL_RELATION,
|
||||
} from '../../ml/common';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue