Skip to content

Commit

Permalink
adding indices options schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Mar 16, 2021
1 parent 8ca21bb commit 76a4479
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
24 changes: 16 additions & 8 deletions x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ export const startDatafeedSchema = schema.object({
timeout: schema.maybe(schema.any()),
});

export const indicesOptionsSchema = schema.object({
expand_wildcards: schema.maybe(
schema.oneOf([
schema.literal('all'),
schema.literal('open'),
schema.literal('closed'),
schema.literal('hidden'),
schema.literal('none'),
])
),
ignore_unavailable: schema.maybe(schema.boolean()),
allow_no_indices: schema.maybe(schema.boolean()),
ignore_throttled: schema.maybe(schema.boolean()),
});

export const datafeedConfigSchema = schema.object({
datafeed_id: schema.maybe(schema.string()),
feed_id: schema.maybe(schema.string()),
Expand All @@ -35,14 +50,7 @@ export const datafeedConfigSchema = schema.object({
runtime_mappings: schema.maybe(schema.any()),
scroll_size: schema.maybe(schema.number()),
delayed_data_check_config: schema.maybe(schema.any()),
indices_options: schema.maybe(
schema.object({
expand_wildcards: schema.maybe(schema.arrayOf(schema.string())),
ignore_unavailable: schema.maybe(schema.boolean()),
allow_no_indices: schema.maybe(schema.boolean()),
ignore_throttled: schema.maybe(schema.boolean()),
})
),
indices_options: indicesOptionsSchema,
});

export const datafeedIdSchema = schema.object({ datafeedId: schema.string() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { indicesOptionsSchema } from './datafeeds_schema';

export const getCardinalityOfFieldsSchema = schema.object({
/** Index or indexes for which to return the time range. */
Expand All @@ -30,5 +31,5 @@ export const getTimeFieldRangeSchema = schema.object({
/** Query to match documents in the index(es). */
query: schema.maybe(schema.any()),
/** Additional search options. */
indicesOptions: schema.maybe(schema.any()),
indicesOptions: indicesOptionsSchema,
});
6 changes: 3 additions & 3 deletions x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { schema } from '@kbn/config-schema';
import { anomalyDetectionJobSchema } from './anomaly_detectors_schema';
import { datafeedConfigSchema } from './datafeeds_schema';
import { datafeedConfigSchema, indicesOptionsSchema } from './datafeeds_schema';

export const categorizationFieldExamplesSchema = {
indexPatternTitle: schema.string(),
Expand All @@ -19,7 +19,7 @@ export const categorizationFieldExamplesSchema = {
end: schema.number(),
analyzer: schema.any(),
runtimeMappings: schema.maybe(schema.any()),
indicesOptions: schema.maybe(schema.any()),
indicesOptions: indicesOptionsSchema,
};

export const chartSchema = {
Expand All @@ -33,7 +33,7 @@ export const chartSchema = {
splitFieldName: schema.maybe(schema.nullable(schema.string())),
splitFieldValue: schema.maybe(schema.nullable(schema.string())),
runtimeMappings: schema.maybe(schema.any()),
indicesOptions: schema.maybe(schema.any()),
indicesOptions: indicesOptionsSchema,
};

export const datafeedIdsSchema = schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

export const estimateBucketSpanSchema = schema.object({
aggTypes: schema.arrayOf(schema.nullable(schema.string())),
Expand All @@ -19,7 +19,7 @@ export const estimateBucketSpanSchema = schema.object({
splitField: schema.maybe(schema.string()),
timeField: schema.maybe(schema.string()),
runtimeMappings: schema.maybe(schema.any()),
indicesOptions: schema.maybe(schema.any()),
indicesOptions: indicesOptionsSchema,
});

export const modelMemoryLimitSchema = schema.object({
Expand Down

0 comments on commit 76a4479

Please sign in to comment.