Skip to content

Validate 'ml.preview_datafeed' API #516

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

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
50 changes: 19 additions & 31 deletions output/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7565,7 +7565,7 @@
"namespace": "ml.preview_datafeed"
},
"since": "5.4.0",
"stability": "TODO",
"stability": "stable",
"urls": [
{
"methods": [
Expand Down Expand Up @@ -101961,28 +101961,22 @@
"name": "indexes",
"required": false,
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
"kind": "instance_of",
"type": {
"name": "Indices",
"namespace": "_types"
}
}
},
{
"description": "An array of index names. Wildcards are supported.",
"name": "indices",
"required": true,
"required": false,
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
"kind": "instance_of",
"type": {
"name": "Indices",
"namespace": "_types"
}
}
},
Expand Down Expand Up @@ -102024,7 +102018,7 @@
{
"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.",
"name": "query",
"required": true,
"required": false,
"type": {
"kind": "instance_of",
"type": {
Expand Down Expand Up @@ -112911,23 +112905,17 @@
},
{
"body": {
"kind": "properties",
"properties": [
{
"name": "data",
"required": true,
"kind": "value",
"value": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "TDocument",
"namespace": "ml.preview_datafeed"
}
}
"name": "TDocument",
"namespace": "ml.preview_datafeed"
}
}
]
}
},
"generics": [
{
Expand Down
10 changes: 4 additions & 6 deletions output/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10325,12 +10325,12 @@ export interface MlDatafeedConfig {
datafeed_id?: Id
delayed_data_check_config?: MlDelayedDataCheckConfig
frequency?: Timestamp
indexes?: string[]
indices: string[]
indexes?: Indices
indices?: Indices
indices_options?: MlDatafeedIndicesOptions
job_id?: Id
max_empty_searches?: integer
query: QueryDslQueryContainer
query?: QueryDslQueryContainer
query_delay?: Timestamp
runtime_mappings?: MappingRuntimeFields
script_fields?: Record<string, ScriptField>
Expand Down Expand Up @@ -11612,9 +11612,7 @@ export interface MlPreviewDatafeedRequest extends RequestBase {
}
}

export interface MlPreviewDatafeedResponse<TDocument = unknown> {
data: TDocument[]
}
export type MlPreviewDatafeedResponse<TDocument = unknown> = TDocument[]

export interface MlPutCalendarRequest extends RequestBase {
calendar_id: Id
Expand Down
6 changes: 3 additions & 3 deletions specification/ml/_types/Datafeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export class DatafeedConfig {
* 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.
*/
frequency?: Timestamp
indexes?: string[]
indexes?: Indices
/**
* An array of index names. Wildcards are supported.
*/
indices: string[]
indices?: Indices
/**
* Specifies index expansion options that are used during search.
*/
Expand All @@ -83,7 +83,7 @@ export class DatafeedConfig {
/**
* 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.
*/
query: QueryContainer
query?: QueryContainer
/**
* 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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { JobConfig } from '@ml/_types/Job'
/**
* @rest_spec_name ml.preview_datafeed
* @since 5.4.0
* @stability TODO
* @stability stable
*/
export interface Request extends RequestBase {
path_parts: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@
*/

export class Response<TDocument> {
body: {
data: TDocument[]
}
body: Array<TDocument>
}