Skip to content

Commit 936cc9a

Browse files
authored
Validate 'ml.preview_datafeed' API (#516)
1 parent 6c98e77 commit 936cc9a

File tree

5 files changed

+28
-44
lines changed

5 files changed

+28
-44
lines changed

output/schema/schema.json

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7565,7 +7565,7 @@
75657565
"namespace": "ml.preview_datafeed"
75667566
},
75677567
"since": "5.4.0",
7568-
"stability": "TODO",
7568+
"stability": "stable",
75697569
"urls": [
75707570
{
75717571
"methods": [
@@ -101984,28 +101984,22 @@
101984101984
"name": "indexes",
101985101985
"required": false,
101986101986
"type": {
101987-
"kind": "array_of",
101988-
"value": {
101989-
"kind": "instance_of",
101990-
"type": {
101991-
"name": "string",
101992-
"namespace": "internal"
101993-
}
101987+
"kind": "instance_of",
101988+
"type": {
101989+
"name": "Indices",
101990+
"namespace": "_types"
101994101991
}
101995101992
}
101996101993
},
101997101994
{
101998101995
"description": "An array of index names. Wildcards are supported.",
101999101996
"name": "indices",
102000-
"required": true,
101997+
"required": false,
102001101998
"type": {
102002-
"kind": "array_of",
102003-
"value": {
102004-
"kind": "instance_of",
102005-
"type": {
102006-
"name": "string",
102007-
"namespace": "internal"
102008-
}
101999+
"kind": "instance_of",
102000+
"type": {
102001+
"name": "Indices",
102002+
"namespace": "_types"
102009102003
}
102010102004
}
102011102005
},
@@ -102047,7 +102041,7 @@
102047102041
{
102048102042
"description": "The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch.",
102049102043
"name": "query",
102050-
"required": true,
102044+
"required": false,
102051102045
"type": {
102052102046
"kind": "instance_of",
102053102047
"type": {
@@ -112945,23 +112939,17 @@
112945112939
},
112946112940
{
112947112941
"body": {
112948-
"kind": "properties",
112949-
"properties": [
112950-
{
112951-
"name": "data",
112952-
"required": true,
112942+
"kind": "value",
112943+
"value": {
112944+
"kind": "array_of",
112945+
"value": {
112946+
"kind": "instance_of",
112953112947
"type": {
112954-
"kind": "array_of",
112955-
"value": {
112956-
"kind": "instance_of",
112957-
"type": {
112958-
"name": "TDocument",
112959-
"namespace": "ml.preview_datafeed"
112960-
}
112961-
}
112948+
"name": "TDocument",
112949+
"namespace": "ml.preview_datafeed"
112962112950
}
112963112951
}
112964-
]
112952+
}
112965112953
},
112966112954
"generics": [
112967112955
{

output/typescript/types.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10327,12 +10327,12 @@ export interface MlDatafeedConfig {
1032710327
datafeed_id?: Id
1032810328
delayed_data_check_config?: MlDelayedDataCheckConfig
1032910329
frequency?: Timestamp
10330-
indexes?: string[]
10331-
indices: string[]
10330+
indexes?: Indices
10331+
indices?: Indices
1033210332
indices_options?: MlDatafeedIndicesOptions
1033310333
job_id?: Id
1033410334
max_empty_searches?: integer
10335-
query: QueryDslQueryContainer
10335+
query?: QueryDslQueryContainer
1033610336
query_delay?: Timestamp
1033710337
runtime_mappings?: MappingRuntimeFields
1033810338
script_fields?: Record<string, ScriptField>
@@ -11615,9 +11615,7 @@ export interface MlPreviewDatafeedRequest extends RequestBase {
1161511615
}
1161611616
}
1161711617

11618-
export interface MlPreviewDatafeedResponse<TDocument = unknown> {
11619-
data: TDocument[]
11620-
}
11618+
export type MlPreviewDatafeedResponse<TDocument = unknown> = TDocument[]
1162111619

1162211620
export interface MlPutCalendarRequest extends RequestBase {
1162311621
calendar_id: Id

specification/ml/_types/Datafeed.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class DatafeedConfig {
6666
* The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. For example: `150s`. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation.
6767
*/
6868
frequency?: Timestamp
69-
indexes?: string[]
69+
indexes?: Indices
7070
/**
7171
* An array of index names. Wildcards are supported.
7272
*/
73-
indices: string[]
73+
indices?: Indices
7474
/**
7575
* Specifies index expansion options that are used during search.
7676
*/
@@ -83,7 +83,7 @@ export class DatafeedConfig {
8383
/**
8484
* The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch.
8585
*/
86-
query: QueryContainer
86+
query?: QueryContainer
8787
/**
8888
* The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between `60s` and `120s`. This randomness improves the query performance when there are multiple jobs running on the same node.
8989
*/

specification/ml/preview_datafeed/MlPreviewDatafeedRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { JobConfig } from '@ml/_types/Job'
2525
/**
2626
* @rest_spec_name ml.preview_datafeed
2727
* @since 5.4.0
28-
* @stability TODO
28+
* @stability stable
2929
*/
3030
export interface Request extends RequestBase {
3131
path_parts: {

specification/ml/preview_datafeed/MlPreviewDatafeedResponse.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@
1818
*/
1919

2020
export class Response<TDocument> {
21-
body: {
22-
data: TDocument[]
23-
}
21+
body: Array<TDocument>
2422
}

0 commit comments

Comments
 (0)