Skip to content

Commit 76a4479

Browse files
committed
adding indices options schema
1 parent 8ca21bb commit 76a4479

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ export const startDatafeedSchema = schema.object({
1313
timeout: schema.maybe(schema.any()),
1414
});
1515

16+
export const indicesOptionsSchema = schema.object({
17+
expand_wildcards: schema.maybe(
18+
schema.oneOf([
19+
schema.literal('all'),
20+
schema.literal('open'),
21+
schema.literal('closed'),
22+
schema.literal('hidden'),
23+
schema.literal('none'),
24+
])
25+
),
26+
ignore_unavailable: schema.maybe(schema.boolean()),
27+
allow_no_indices: schema.maybe(schema.boolean()),
28+
ignore_throttled: schema.maybe(schema.boolean()),
29+
});
30+
1631
export const datafeedConfigSchema = schema.object({
1732
datafeed_id: schema.maybe(schema.string()),
1833
feed_id: schema.maybe(schema.string()),
@@ -35,14 +50,7 @@ export const datafeedConfigSchema = schema.object({
3550
runtime_mappings: schema.maybe(schema.any()),
3651
scroll_size: schema.maybe(schema.number()),
3752
delayed_data_check_config: schema.maybe(schema.any()),
38-
indices_options: schema.maybe(
39-
schema.object({
40-
expand_wildcards: schema.maybe(schema.arrayOf(schema.string())),
41-
ignore_unavailable: schema.maybe(schema.boolean()),
42-
allow_no_indices: schema.maybe(schema.boolean()),
43-
ignore_throttled: schema.maybe(schema.boolean()),
44-
})
45-
),
53+
indices_options: indicesOptionsSchema,
4654
});
4755

4856
export const datafeedIdSchema = schema.object({ datafeedId: schema.string() });

x-pack/plugins/ml/server/routes/schemas/fields_service_schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import { schema } from '@kbn/config-schema';
9+
import { indicesOptionsSchema } from './datafeeds_schema';
910

1011
export const getCardinalityOfFieldsSchema = schema.object({
1112
/** Index or indexes for which to return the time range. */
@@ -30,5 +31,5 @@ export const getTimeFieldRangeSchema = schema.object({
3031
/** Query to match documents in the index(es). */
3132
query: schema.maybe(schema.any()),
3233
/** Additional search options. */
33-
indicesOptions: schema.maybe(schema.any()),
34+
indicesOptions: indicesOptionsSchema,
3435
});

x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { schema } from '@kbn/config-schema';
99
import { anomalyDetectionJobSchema } from './anomaly_detectors_schema';
10-
import { datafeedConfigSchema } from './datafeeds_schema';
10+
import { datafeedConfigSchema, indicesOptionsSchema } from './datafeeds_schema';
1111

1212
export const categorizationFieldExamplesSchema = {
1313
indexPatternTitle: schema.string(),
@@ -19,7 +19,7 @@ export const categorizationFieldExamplesSchema = {
1919
end: schema.number(),
2020
analyzer: schema.any(),
2121
runtimeMappings: schema.maybe(schema.any()),
22-
indicesOptions: schema.maybe(schema.any()),
22+
indicesOptions: indicesOptionsSchema,
2323
};
2424

2525
export const chartSchema = {
@@ -33,7 +33,7 @@ export const chartSchema = {
3333
splitFieldName: schema.maybe(schema.nullable(schema.string())),
3434
splitFieldValue: schema.maybe(schema.nullable(schema.string())),
3535
runtimeMappings: schema.maybe(schema.any()),
36-
indicesOptions: schema.maybe(schema.any()),
36+
indicesOptions: indicesOptionsSchema,
3737
};
3838

3939
export const datafeedIdsSchema = schema.object({

x-pack/plugins/ml/server/routes/schemas/job_validation_schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { schema } from '@kbn/config-schema';
99
import { analysisConfigSchema, anomalyDetectionJobSchema } from './anomaly_detectors_schema';
10-
import { datafeedConfigSchema } from './datafeeds_schema';
10+
import { datafeedConfigSchema, indicesOptionsSchema } from './datafeeds_schema';
1111

1212
export const estimateBucketSpanSchema = schema.object({
1313
aggTypes: schema.arrayOf(schema.nullable(schema.string())),
@@ -19,7 +19,7 @@ export const estimateBucketSpanSchema = schema.object({
1919
splitField: schema.maybe(schema.string()),
2020
timeField: schema.maybe(schema.string()),
2121
runtimeMappings: schema.maybe(schema.any()),
22-
indicesOptions: schema.maybe(schema.any()),
22+
indicesOptions: indicesOptionsSchema,
2323
});
2424

2525
export const modelMemoryLimitSchema = schema.object({

0 commit comments

Comments
 (0)