Skip to content

Removed redundant date types #1673

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

Closed
wants to merge 3 commits into from
Closed
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
234 changes: 91 additions & 143 deletions output/schema/schema.json

Large diffs are not rendered by default.

174 changes: 84 additions & 90 deletions output/typescript/types.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion specification/_doc_ids/table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,5 @@ index-modules-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{
templating-role-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/field-and-document-access-control.html#templating-role-query
mapping-settings-limit,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/mapping-settings-limit.html
index-modules-slowlog-slowlog,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/index-modules-slowlog.html#index-slow-log
multi-fields,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/multi-fields.html
multi-fields,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/multi-fields.html
date-math,https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math
6 changes: 3 additions & 3 deletions specification/_global/reindex/ReindexResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TaskId } from '@_types/common'
import { BulkIndexByScrollFailure } from '@_types/Errors'
import { integer, long } from '@_types/Numeric'
import { Retries } from '@_types/Retries'
import { EpochMillis, Time } from '@_types/Time'
import { Time } from '@_types/Time'

export class Response {
body: {
Expand All @@ -34,8 +34,8 @@ export class Response {
requests_per_second?: long
slice_id?: integer
task?: TaskId
throttled_millis?: EpochMillis
throttled_until_millis?: EpochMillis
throttled_millis?: Time
throttled_until_millis?: Time
timed_out?: boolean
took?: Time
total?: long
Expand Down
18 changes: 12 additions & 6 deletions specification/_types/Time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@ export class DateMathTimeParsed {
interval: DateMathTimeUnit
}

/**
* A timestamp, for example "2015-01-01T12:10:30Z" or "2015-01-01"
*/
export type DateString = string
export type Timestamp = string
/**
* A duration, for example "5m" or "1M"
*/
export type TimeSpan = string
export type EpochMillis = string | long
/**
* Operations related to a date, for example "now-1h" or "2001.02.01\|\|+1M/d"
* @doc_id date-math
*/
export type DateMath = string
export type DateMathExpression = string
export type DateMathTime = string

/** @codegen_names date, millis */
export type DateOrEpochMillis = DateString | EpochMillis
export type DateOrEpochMillis = DateString | Time

export type TimeZone = string

Expand Down Expand Up @@ -68,7 +74,7 @@ export enum DateMathTimeUnit {
* @codegen_names time, offset
*/
//FIXME: need to distinguish durations (has to be a string), offsets (can be a string or number)
export type Time = string | integer
export type Time = string | long

export enum TimeUnit {
/** @codegen_name nanoseconds */
Expand Down
6 changes: 3 additions & 3 deletions specification/_types/aggregations/Aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { AggregateName, Field, FieldValue, Metadata } from '@_types/common'
import { GeoBounds, GeoHash, GeoLine, GeoLocation, GeoTile } from '@_types/Geo'
import { double, integer, long } from '@_types/Numeric'
import { DateMathTime, EpochMillis } from '@_types/Time'
import { DateMath, Time } from '@_types/Time'
import { Void } from '@spec_utils/VoidValue'

/**
Expand Down Expand Up @@ -337,13 +337,13 @@ export class DateHistogramAggregate extends MultiBucketAggregateBase<DateHistogr

export class DateHistogramBucket extends MultiBucketBase {
key_as_string?: string
key: EpochMillis
key: Time
}

/** @variant name=auto_date_histogram */
// Note: no keyed variant in `InternalAutoDateHistogram`
export class AutoDateHistogramAggregate extends MultiBucketAggregateBase<DateHistogramBucket> {
interval: DateMathTime
interval: DateMath
}

/** @variant name=variable_width_histogram */
Expand Down
2 changes: 1 addition & 1 deletion specification/_types/query_dsl/fulltext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class MatchQuery extends QueryBase {
operator?: Operator
/** @server_default 0 */
prefix_length?: integer
// FIXME: docs states "date" as a possible format. Add DateMath, or DateMathTime?
// FIXME: docs states "date" as a possible format. Add DateMath, or DateMath?
// Should also be consisitent with MultiMatchQuery.query
query: string | float | boolean
/** @server_default 'none' */
Expand Down
6 changes: 3 additions & 3 deletions specification/async_search/_types/AsyncSearchResponseBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
*/

import { Id } from '@_types/common'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'
import { AsyncSearch } from './AsyncSearch'

export class AsyncSearchResponseBase {
id?: Id
is_partial: boolean
is_running: boolean
expiration_time_in_millis: EpochMillis
start_time_in_millis: EpochMillis
expiration_time_in_millis: Time
start_time_in_millis: Time
}
export class AsyncSearchDocumentResponseBase<
TDocument
Expand Down
4 changes: 2 additions & 2 deletions specification/cat/count/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/

import { DateString, EpochMillis } from '@_types/Time'
import { DateString, Time } from '@_types/Time'

export class CountRecord {
/**
* seconds since 1969-01-01 00:00:00
* @aliases t,time
*/
'epoch'?: EpochMillis
'epoch'?: Time
/**
* time in HH:MM:SS
* @aliases ts,hms,hhmmss
Expand Down
4 changes: 2 additions & 2 deletions specification/cat/health/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/

import { DateString, EpochMillis } from '@_types/Time'
import { DateString, Time } from '@_types/Time'

export class HealthRecord {
/**
* seconds since 1969-01-01 00:00:00
* @aliases time
*/
'epoch'?: EpochMillis
'epoch'?: Time
/**
* time in HH:MM:SS
* @aliases ts,hms,hhmmss
Expand Down
6 changes: 3 additions & 3 deletions specification/cat/snapshots/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { DateString, EpochMillis, Time } from '@_types/Time'
import { DateString, Time } from '@_types/Time'

export class SnapshotsRecord {
/**
Expand All @@ -39,7 +39,7 @@ export class SnapshotsRecord {
* start time in seconds since 1970-01-01 00:00:00
* @aliases ste,startEpoch
*/
'start_epoch'?: EpochMillis
'start_epoch'?: Time
/**
* start time in HH:MM:SS
* @aliases sti,startTime
Expand All @@ -49,7 +49,7 @@ export class SnapshotsRecord {
* end time in seconds since 1970-01-01 00:00:00
* @aliases ete,endEpoch
*/
'end_epoch'?: EpochMillis
'end_epoch'?: Time
/**
* end time in HH:MM:SS
* @aliases eti,endTime
Expand Down
10 changes: 5 additions & 5 deletions specification/ccr/_types/FollowIndexStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '@_types/common'
import { ErrorCause } from '@_types/Errors'
import { integer, long } from '@_types/Numeric'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'

export class FollowIndexStats {
index: IndexName
Expand Down Expand Up @@ -56,10 +56,10 @@ export class ShardStats {
shard_id: integer
successful_read_requests: long
successful_write_requests: long
time_since_last_read_millis: EpochMillis
total_read_remote_exec_time_millis: EpochMillis
total_read_time_millis: EpochMillis
total_write_time_millis: EpochMillis
time_since_last_read_millis: Time
total_read_remote_exec_time_millis: Time
total_read_time_millis: Time
total_write_time_millis: Time
write_buffer_operation_count: long
write_buffer_size_in_bytes: ByteSize
}
Expand Down
4 changes: 2 additions & 2 deletions specification/cluster/health/ClusterHealthResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { Dictionary } from '@spec_utils/Dictionary'
import { HealthStatus, IndexName, Name } from '@_types/common'
import { integer, Percentage } from '@_types/Numeric'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'
import { IndexHealthStats } from './types'

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export class Response {
relocating_shards: integer
status: HealthStatus
/** The time expressed in milliseconds since the earliest initiated task is waiting for being performed. */
task_max_waiting_in_queue_millis: EpochMillis
task_max_waiting_in_queue_millis: Time
/** If false the response returned within the period of time that is specified by the timeout parameter (30s by default) */
timed_out: boolean
/** The number of shards that are not allocated. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Ids } from '@_types/common'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'

export class Response {
body: {
Expand All @@ -29,6 +29,6 @@ export class Response {
export class DanglingIndex {
index_name: string
index_uuid: string
creation_date_millis: EpochMillis
creation_date_millis: Time
node_ids: Ids
}
6 changes: 3 additions & 3 deletions specification/eql/get_status/EqlGetStatusResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { Id } from '@_types/common'
import { integer } from '@_types/Numeric'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'

export class Response {
body: {
Expand All @@ -38,11 +38,11 @@ export class Response {
/**
* For a running search shows a timestamp when the eql search started, in milliseconds since the Unix epoch.
*/
start_time_in_millis?: EpochMillis
start_time_in_millis?: Time
/**
* Shows a timestamp when the eql search will be expired, in milliseconds since the Unix epoch. When this time is reached, the search and its results are deleted, even if the search is still ongoing.
*/
expiration_time_in_millis?: EpochMillis
expiration_time_in_millis?: Time
/**
* For a completed search shows the http status code of the completed search.
*/
Expand Down
14 changes: 7 additions & 7 deletions specification/ilm/explain_lifecycle/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ import { Dictionary } from '@spec_utils/Dictionary'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { IndexName, Name, VersionNumber } from '@_types/common'
import { integer } from '@_types/Numeric'
import { EpochMillis, Time } from '@_types/Time'
import { Time } from '@_types/Time'

export class LifecycleExplainManaged {
action: Name
action_time_millis: EpochMillis
action_time_millis: Time
age: Time
failed_step?: Name
failed_step_retry_count?: integer
index: IndexName
index_creation_date_millis?: EpochMillis
index_creation_date_millis?: Time
is_auto_retryable_error?: boolean
lifecycle_date_millis: EpochMillis
lifecycle_date_millis: Time
managed: true
phase: Name
phase_time_millis: EpochMillis
phase_time_millis: Time
policy: Name
step: Name
step_info?: Dictionary<string, UserDefinedValue>
step_time_millis: EpochMillis
step_time_millis: Time
phase_execution: LifecycleExplainPhaseExecution
time_since_index_creation?: Time
}
Expand All @@ -57,5 +57,5 @@ export type LifecycleExplain =
export class LifecycleExplainPhaseExecution {
policy: Name
version: VersionNumber
modified_date_in_millis: EpochMillis
modified_date_in_millis: Time
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Dictionary } from '@spec_utils/Dictionary'
import { Field, IndexName } from '@_types/common'
import { uint } from '@_types/Numeric'
import { ShardStatistics } from '@_types/Stats'
import { EpochMillis } from '@_types/Time'
import { Time } from '@_types/Time'

export class Response {
body: FieldsUsageBody
Expand All @@ -43,7 +43,7 @@ export class UsageStatsShards {
routing: ShardRouting
stats: ShardsStats
tracking_id: string
tracking_started_at_millis: EpochMillis
tracking_started_at_millis: Time
}

export class ShardsStats {
Expand Down
20 changes: 10 additions & 10 deletions specification/indices/recovery/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@_types/common'
import { Host, TransportAddress, Ip } from '@_types/Networking'
import { long, Percentage } from '@_types/Numeric'
import { Time, EpochMillis, DateString } from '@_types/Time'
import { Time, DateString } from '@_types/Time'

export class RecoveryBytes {
percent: Percentage
Expand Down Expand Up @@ -60,10 +60,10 @@ export class RecoveryIndexStatus {
files: RecoveryFiles
size: RecoveryBytes
source_throttle_time?: Time
source_throttle_time_in_millis: EpochMillis
source_throttle_time_in_millis: Time
target_throttle_time?: Time
target_throttle_time_in_millis: EpochMillis
total_time_in_millis: EpochMillis
target_throttle_time_in_millis: Time
total_time_in_millis: Time
total_time?: Time
}

Expand Down Expand Up @@ -97,14 +97,14 @@ export class TranslogStatus {
total: long
total_on_start: long
total_time?: string
total_time_in_millis: EpochMillis
total_time_in_millis: Time
}

export class VerifyIndex {
check_index_time?: Time
check_index_time_in_millis: EpochMillis
check_index_time_in_millis: Time
total_time?: Time
total_time_in_millis: EpochMillis
total_time_in_millis: Time
}

export class ShardRecovery {
Expand All @@ -115,12 +115,12 @@ export class ShardRecovery {
stage: string
start?: RecoveryStartStatus
start_time?: DateString
start_time_in_millis: EpochMillis
start_time_in_millis: Time
stop_time?: DateString
stop_time_in_millis: EpochMillis
stop_time_in_millis: Time
target: RecoveryOrigin
total_time?: DateString
total_time_in_millis: EpochMillis
total_time_in_millis: Time
translog: TranslogStatus
type: string
verify_index: VerifyIndex
Expand Down
4 changes: 2 additions & 2 deletions specification/indices/rollover/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { ByteSize } from '@_types/common'
import { long } from '@_types/Numeric'
import { EpochMillis, Time } from '@_types/Time'
import { Time } from '@_types/Time'

export class RolloverConditions {
max_age?: Time
Expand All @@ -28,5 +28,5 @@ export class RolloverConditions {
max_size_bytes?: ByteSize
max_primary_shard_size?: ByteSize
max_primary_shard_size_bytes?: ByteSize
max_age_millis?: EpochMillis
max_age_millis?: Time
}
Loading