Skip to content

Commit 4b046c7

Browse files
committed
Refactor date, time and durations
1 parent 9ec5d7d commit 4b046c7

File tree

250 files changed

+3109
-2576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+3109
-2576
lines changed

docs/modeling-guide.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,16 @@ feel free to add more if it feels appropriate!
156156
157157
### Dates
158158
159-
The `Date` type in TypeScript refers to the JavaScript `Date` object,
160-
since Elasticsearch needs a string or a numeric value, there are aliases also for date types:
159+
Elasticsearch uses a lot of dates, times and durations. There are various types available to capture the variety of types and representations in the specification:
160+
161+
* for date and time: `DateTime` for formatted dates, `EpochMillis`, `EpochSeconds`, etc. for number values
162+
* for intervals: `TimeSpan` for formatted values, `TimeSpanMillis`, `TimeSpanSeconds`, etc. for number values
163+
* for time of day: `TimeOfDay
164+
165+
See [`specification/_types/Time.ts`](../specification/_types/Time.ts) for additional details.
166+
167+
Since code generators may choose to use a platform builtin type to represent time-related data, make sure to choose the appropriate representation and **never** use a primitive value such as `string` or `long`.
161168

162-
```ts
163-
type DateTime = string
164-
type TimeSpan = string
165-
type DateTime = string
166-
```
167169

168170
### Binary
169171

docs/validation-example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ open it with your favourite editor and perform the fix
6969
pipeline?: string;
7070
refresh?: Refresh;
7171
routing?: Routing;
72-
timeout?: Time;
72+
timeout?: TimeSpan;
7373
version?: long;
7474
version_type?: VersionType;
7575
wait_for_active_shards?: string;

0 commit comments

Comments
 (0)