From 7e140693f2bbd392b95f54f2cd2b0c0895db2e5d Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Mon, 8 Jan 2024 11:31:40 +0100 Subject: [PATCH] Cleanup enum values, allow using identifier+value as an alternative to @codegen_name (#2379) --- compiler/src/model/utils.ts | 7 +- docs/modeling-guide.md | 35 ++++- output/schema/schema.json | 128 +++++++++--------- .../_global/search/_types/highlighting.ts | 24 ++-- specification/_global/search/_types/hits.ts | 4 +- .../_global/search/_types/rescoring.ts | 10 +- .../_global/search/_types/suggester.ts | 14 +- specification/_types/Geo.ts | 39 ++---- specification/_types/Lifecycle.ts | 6 +- specification/_types/Logging.ts | 10 +- specification/_types/Node.ts | 28 ++-- specification/_types/Result.ts | 11 +- specification/_types/Scripting.ts | 8 +- specification/_types/Similarity.ts | 44 +++--- specification/_types/Stats.ts | 10 +- specification/_types/Time.ts | 21 +-- specification/_types/aggregations/bucket.ts | 30 ++-- specification/_types/aggregations/metric.ts | 20 +-- specification/_types/aggregations/pipeline.ts | 6 +- specification/_types/aggregations/visitor.ts | 6 +- specification/_types/analysis/icu-plugin.ts | 36 ++--- .../_types/analysis/kuromoji-plugin.ts | 6 +- specification/_types/analysis/languages.ts | 112 +++++++-------- .../_types/analysis/phonetic-plugin.ts | 58 ++++---- .../_types/analysis/token_filters.ts | 18 +-- specification/_types/analysis/tokenizers.ts | 18 +-- specification/_types/common.ts | 88 ++++++------ specification/_types/mapping/RuntimeFields.ts | 14 +- .../_types/mapping/dynamic-template.ts | 4 +- specification/_types/mapping/geo.ts | 8 +- .../_types/query_dsl/RewriteMultiTerm.ts | 12 +- .../_types/query_dsl/VisitorScope.ts | 18 +-- specification/_types/query_dsl/compound.ts | 52 +++---- specification/_types/query_dsl/fulltext.ts | 42 +++--- specification/_types/query_dsl/geo.ts | 30 ++-- specification/_types/query_dsl/joining.ts | 10 +- specification/_types/query_dsl/term.ts | 6 +- specification/_types/sort.ts | 22 +-- specification/cat/transforms/types.ts | 16 +-- specification/ccr/follow_info/types.ts | 4 +- .../cluster/allocation_explain/types.ts | 66 ++++----- specification/enrich/execute_policy/types.ts | 8 +- specification/eql/search/types.ts | 4 +- specification/indices/_types/DataStream.ts | 12 +- .../indices/_types/FielddataLoading.ts | 4 +- .../indices/_types/GeoPointFielddataFormat.ts | 8 +- specification/indices/_types/IndexRouting.ts | 16 +-- .../indices/_types/IndexSegmentSort.ts | 6 +- .../indices/_types/NumericFielddataFormat.ts | 4 +- .../indices/_types/StringFielddataFormat.ts | 4 +- .../add_block/IndicesAddBlockRequest.ts | 8 +- specification/indices/shard_stores/types.ts | 14 +- specification/inference/_types/TaskType.ts | 4 +- specification/ingest/_types/Pipeline.ts | 20 +-- specification/ingest/_types/Processors.ts | 38 +++--- specification/license/_types/License.ts | 26 ++-- specification/migration/deprecations/types.ts | 8 +- specification/ml/_types/Dataframe.ts | 10 +- specification/ml/_types/Detector.ts | 8 +- specification/ml/_types/Functions.ts | 66 ++++----- specification/ml/_types/Job.ts | 16 +-- specification/ml/_types/Rule.ts | 20 +-- specification/ml/_types/TrainedModel.ts | 22 +-- specification/rollup/get_jobs/types.ts | 10 +- .../searchable_snapshots/_types/stats.ts | 6 +- specification/security/_types/RoleTemplate.ts | 4 +- specification/security/get_token/types.ts | 8 +- specification/security/grant_api_key/types.ts | 4 +- .../_types/SnapshotShardsStatsStage.ts | 10 +- specification/watcher/_types/Action.ts | 26 ++-- specification/watcher/_types/Conditions.ts | 14 +- specification/watcher/_types/Execution.ts | 32 ++--- specification/watcher/_types/Input.ts | 26 ++-- specification/watcher/_types/Schedule.ts | 53 ++++---- specification/watcher/stats/types.ts | 16 +-- 75 files changed, 816 insertions(+), 820 deletions(-) diff --git a/compiler/src/model/utils.ts b/compiler/src/model/utils.ts index 2e27ac3785..e999ce2c4f 100644 --- a/compiler/src/model/utils.ts +++ b/compiler/src/model/utils.ts @@ -440,9 +440,14 @@ export function modelEnumDeclaration (declaration: EnumDeclaration): model.Enum .map(m => { // names that contains `.` or `-` will be wrapped inside single quotes const name = m.getName().replace(/'/g, '') - const member = { + const member: model.EnumMember = { name: name } + const value = m.getValue() + if (value != null && (typeof value === 'string')) { + member.name = value + member.codegenName = name + } hoistEnumMemberAnnotations(member, m.getJsDocs()) return member diff --git a/docs/modeling-guide.md b/docs/modeling-guide.md index e0ca5d56db..d2a1b78b94 100644 --- a/docs/modeling-guide.md +++ b/docs/modeling-guide.md @@ -75,18 +75,45 @@ property: Dictionary ### Enum -Represents a set of allowed values: +Represents a set of allowed values. + ```ts enum MyEnum { - first = 0, - second = 1, - third = 2 + first, + second, + third } property: MyEnum ``` +Note that you don't have to provide both identifiers and values as is common in TypeScript. When there's only an identifier, the API specification compiler will use it for both the identifier and the value of enum members. + +Also do not use identifiers and values for the sole purpose of providing upper-case identifiers (e.g. `FOO = 'foo'`). Each language generator will use the identifier casing that is expected by that language. + +Some enumerations contain values that aren't identifiers, or that are not explicit enough. In that case you can either assign values to enum members or use the `@codegen_name` jsdoc tag to define the identifier that will be used by code generators: + +```ts +enum MyEnum { + percent_of_sum, + mean, + /** @codegen_name z_score */ + 'z-score', + softmax +} + +export enum IntervalUnit { + second = 's', + minute = 'm', + hour = 'h', + day = 'd', + week = 'w' +} +``` + +**Use custom identifiers for enum members sparingly**: we want to keep identifiers as close as possible to their value in JSON payloads to that usesr can easily map values found in the Elasticsearch reference documentation to code identifiers in the client libraries. + Some enumerations accept alternate values for some of their members. The `@aliases` jsdoc tac can be used to capture these values: ```ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 190e5490f7..58db4af993 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -40555,7 +40555,7 @@ "name": "Bytes", "namespace": "_types" }, - "specLocation": "_types/common.ts#L169-L187" + "specLocation": "_types/common.ts#L169-L181" }, { "kind": "type_alias", @@ -40698,7 +40698,7 @@ "name": "ClusterInfoTarget", "namespace": "_types" }, - "specLocation": "_types/common.ts#L384-L390" + "specLocation": "_types/common.ts#L378-L384" }, { "kind": "type_alias", @@ -40706,7 +40706,7 @@ "name": "ClusterInfoTargets", "namespace": "_types" }, - "specLocation": "_types/common.ts#L392-L392", + "specLocation": "_types/common.ts#L386-L386", "type": { "items": [ { @@ -40925,7 +40925,7 @@ "name": "Conflicts", "namespace": "_types" }, - "specLocation": "_types/common.ts#L189-L198" + "specLocation": "_types/common.ts#L183-L192" }, { "kind": "interface", @@ -40979,7 +40979,7 @@ } } ], - "specLocation": "_types/Geo.ts#L163-L168" + "specLocation": "_types/Geo.ts#L154-L159" }, { "kind": "enum", @@ -41225,7 +41225,7 @@ "name": "DistanceUnit", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L30-L49" + "specLocation": "_types/Geo.ts#L30-L40" }, { "kind": "interface", @@ -41654,7 +41654,7 @@ "name": "ExpandWildcard", "namespace": "_types" }, - "specLocation": "_types/common.ts#L207-L221" + "specLocation": "_types/common.ts#L201-L215" }, { "kind": "type_alias", @@ -41662,7 +41662,7 @@ "name": "ExpandWildcards", "namespace": "_types" }, - "specLocation": "_types/common.ts#L223-L223", + "specLocation": "_types/common.ts#L217-L217", "type": { "items": [ { @@ -42136,7 +42136,7 @@ "name": "GeoBounds", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L144-L157", + "specLocation": "_types/Geo.ts#L135-L148", "type": { "items": [ { @@ -42294,7 +42294,7 @@ "name": "GeoDistanceType", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L51-L60" + "specLocation": "_types/Geo.ts#L42-L51" }, { "kind": "type_alias", @@ -42302,7 +42302,7 @@ "name": "GeoHash", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L100-L100", + "specLocation": "_types/Geo.ts#L91-L91", "type": { "kind": "instance_of", "type": { @@ -42330,7 +42330,7 @@ } } ], - "specLocation": "_types/Geo.ts#L140-L142" + "specLocation": "_types/Geo.ts#L131-L133" }, { "codegenNames": [ @@ -42343,7 +42343,7 @@ "name": "GeoHashPrecision", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L95-L99", + "specLocation": "_types/Geo.ts#L86-L90", "type": { "items": [ { @@ -42371,7 +42371,7 @@ "name": "GeoHexCell", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L105-L106", + "specLocation": "_types/Geo.ts#L96-L97", "type": { "kind": "instance_of", "type": { @@ -42419,7 +42419,7 @@ } } ], - "specLocation": "_types/Geo.ts#L65-L71" + "specLocation": "_types/Geo.ts#L56-L62" }, { "codegenNames": [ @@ -42434,7 +42434,7 @@ "name": "GeoLocation", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L113-L127", + "specLocation": "_types/Geo.ts#L104-L118", "type": { "items": [ { @@ -42479,7 +42479,7 @@ "name": "GeoShape", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L62-L63", + "specLocation": "_types/Geo.ts#L53-L54", "type": { "kind": "user_defined_value" } @@ -42508,7 +42508,7 @@ "name": "GeoShapeRelation", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L73-L91" + "specLocation": "_types/Geo.ts#L64-L82" }, { "description": "A map tile reference, represented as `{zoom}/{x}/{y}`", @@ -42517,7 +42517,7 @@ "name": "GeoTile", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L102-L103", + "specLocation": "_types/Geo.ts#L93-L94", "type": { "kind": "instance_of", "type": { @@ -42532,7 +42532,7 @@ "name": "GeoTilePrecision", "namespace": "_types" }, - "specLocation": "_types/Geo.ts#L93-L93", + "specLocation": "_types/Geo.ts#L84-L84", "type": { "kind": "instance_of", "type": { @@ -42717,7 +42717,7 @@ "name": "HealthStatus", "namespace": "_types" }, - "specLocation": "_types/common.ts#L225-L245" + "specLocation": "_types/common.ts#L219-L239" }, { "kind": "type_alias", @@ -43217,7 +43217,7 @@ } } ], - "specLocation": "_types/common.ts#L338-L365" + "specLocation": "_types/common.ts#L332-L359" }, { "inherits": { @@ -43356,7 +43356,7 @@ } } ], - "specLocation": "_types/common.ts#L327-L336" + "specLocation": "_types/common.ts#L321-L330" }, { "inherits": { @@ -43590,7 +43590,7 @@ } } ], - "specLocation": "_types/Geo.ts#L129-L138" + "specLocation": "_types/Geo.ts#L120-L129" }, { "kind": "enum", @@ -43609,7 +43609,7 @@ "name": "Level", "namespace": "_types" }, - "specLocation": "_types/common.ts#L255-L259" + "specLocation": "_types/common.ts#L249-L253" }, { "kind": "enum", @@ -44570,7 +44570,7 @@ "name": "OpType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L261-L270" + "specLocation": "_types/common.ts#L255-L264" }, { "kind": "type_alias", @@ -44578,7 +44578,7 @@ "name": "Password", "namespace": "_types" }, - "specLocation": "_types/common.ts#L201-L201", + "specLocation": "_types/common.ts#L195-L195", "type": { "kind": "instance_of", "type": { @@ -45019,7 +45019,7 @@ "name": "Refresh", "namespace": "_types" }, - "specLocation": "_types/common.ts#L272-L279" + "specLocation": "_types/common.ts#L266-L273" }, { "kind": "interface", @@ -45260,7 +45260,7 @@ "name": "Result", "namespace": "_types" }, - "specLocation": "_types/Result.ts#L20-L27" + "specLocation": "_types/Result.ts#L20-L26" }, { "kind": "interface", @@ -46039,7 +46039,7 @@ "name": "SearchType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L281-L286" + "specLocation": "_types/common.ts#L275-L280" }, { "kind": "interface", @@ -46588,7 +46588,7 @@ "name": "Slices", "namespace": "_types" }, - "specLocation": "_types/common.ts#L367-L372", + "specLocation": "_types/common.ts#L361-L366", "type": { "items": [ { @@ -46621,7 +46621,7 @@ "name": "SlicesCalculation", "namespace": "_types" }, - "specLocation": "_types/common.ts#L374-L382" + "specLocation": "_types/common.ts#L368-L376" }, { "kind": "type_alias", @@ -47017,7 +47017,7 @@ "name": "SuggestMode", "namespace": "_types" }, - "specLocation": "_types/common.ts#L288-L301" + "specLocation": "_types/common.ts#L282-L295" }, { "description": "The suggestion name as returned from the server. Depending whether typed_keys is specified this could come back\nin the form of `name#type` instead of simply `name`", @@ -47171,7 +47171,7 @@ "name": "ThreadType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L303-L309" + "specLocation": "_types/common.ts#L297-L303" }, { "description": "Time of day, expressed as HH:MM:SS", @@ -47225,7 +47225,7 @@ "name": "TimeUnit", "namespace": "_types" }, - "specLocation": "_types/Time.ts#L69-L84" + "specLocation": "_types/Time.ts#L69-L77" }, { "kind": "type_alias", @@ -47272,7 +47272,7 @@ } } ], - "specLocation": "_types/Geo.ts#L170-L173" + "specLocation": "_types/Geo.ts#L161-L164" }, { "kind": "interface", @@ -47304,7 +47304,7 @@ } } ], - "specLocation": "_types/Geo.ts#L175-L178" + "specLocation": "_types/Geo.ts#L166-L169" }, { "kind": "interface", @@ -47527,7 +47527,7 @@ "name": "Username", "namespace": "_types" }, - "specLocation": "_types/common.ts#L200-L200", + "specLocation": "_types/common.ts#L194-L194", "type": { "kind": "instance_of", "type": { @@ -47620,7 +47620,7 @@ "name": "WaitForActiveShardOptions", "namespace": "_types" }, - "specLocation": "_types/common.ts#L311-L315" + "specLocation": "_types/common.ts#L305-L309" }, { "codegenNames": [ @@ -47679,7 +47679,7 @@ "name": "WaitForEvents", "namespace": "_types" }, - "specLocation": "_types/common.ts#L317-L324" + "specLocation": "_types/common.ts#L311-L318" }, { "kind": "interface", @@ -47763,7 +47763,7 @@ } } ], - "specLocation": "_types/Geo.ts#L159-L161" + "specLocation": "_types/Geo.ts#L150-L152" }, { "kind": "interface", @@ -54700,7 +54700,7 @@ "name": "HoltWintersType", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L283-L288" + "specLocation": "_types/aggregations/pipeline.ts#L283-L286" }, { "attachedBehaviors": [ @@ -56295,7 +56295,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L290-L305" + "specLocation": "_types/aggregations/pipeline.ts#L288-L303" }, { "inherits": { @@ -56347,7 +56347,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L307-L319" + "specLocation": "_types/aggregations/pipeline.ts#L305-L317" }, { "generics": [ @@ -56781,7 +56781,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L321-L326" + "specLocation": "_types/aggregations/pipeline.ts#L319-L324" }, { "kind": "enum", @@ -56816,7 +56816,7 @@ "name": "NormalizeMethod", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/pipeline.ts#L328-L354" + "specLocation": "_types/aggregations/pipeline.ts#L326-L352" }, { "attachedBehaviors": [ @@ -57128,7 +57128,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L356-L361" + "specLocation": "_types/aggregations/pipeline.ts#L354-L359" }, { "inherits": { @@ -57832,7 +57832,7 @@ } } ], - "specLocation": "_types/aggregations/pipeline.ts#L363-L369" + "specLocation": "_types/aggregations/pipeline.ts#L361-L367" }, { "inherits": { @@ -59045,7 +59045,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L371-L371" + "specLocation": "_types/aggregations/pipeline.ts#L369-L369" }, { "description": "Result of the `rare_terms` aggregation when the field is a string.", @@ -59420,7 +59420,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/pipeline.ts#L373-L373" + "specLocation": "_types/aggregations/pipeline.ts#L371-L371" }, { "kind": "interface", @@ -110942,7 +110942,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L43-L116" + "specLocation": "indices/_types/DataStream.ts#L39-L112" }, { "kind": "interface", @@ -111012,7 +111012,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L125-L146" + "specLocation": "indices/_types/DataStream.ts#L121-L142" }, { "description": "Data lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.", @@ -111259,7 +111259,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L118-L123" + "specLocation": "indices/_types/DataStream.ts#L114-L119" }, { "kind": "interface", @@ -111280,7 +111280,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L148-L150" + "specLocation": "indices/_types/DataStream.ts#L144-L146" }, { "kind": "interface", @@ -113403,7 +113403,7 @@ "name": "ManagedBy", "namespace": "indices._types" }, - "specLocation": "indices/_types/DataStream.ts#L32-L41" + "specLocation": "indices/_types/DataStream.ts#L32-L37" }, { "description": "Mapping Limit Settings", @@ -113830,7 +113830,7 @@ "name": "SegmentSortMissing", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSegmentSort.ts#L43-L48" + "specLocation": "indices/_types/IndexSegmentSort.ts#L43-L46" }, { "kind": "enum", @@ -191915,7 +191915,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L110-L113" + "specLocation": "watcher/_types/Schedule.ts#L105-L108" }, { "kind": "interface", @@ -192728,7 +192728,7 @@ "name": "Month", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Schedule.ts#L70-L83" + "specLocation": "watcher/_types/Schedule.ts#L65-L78" }, { "kind": "interface", @@ -193331,7 +193331,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L85-L96", + "specLocation": "watcher/_types/Schedule.ts#L80-L91", "variants": { "kind": "container" } @@ -193347,7 +193347,7 @@ "name": "ScheduleTimeOfDay", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Schedule.ts#L103-L108", + "specLocation": "watcher/_types/Schedule.ts#L98-L103", "type": { "items": [ { @@ -193398,7 +193398,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L98-L101" + "specLocation": "watcher/_types/Schedule.ts#L93-L96" }, { "kind": "interface", @@ -194206,7 +194206,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L115-L118" + "specLocation": "watcher/_types/Schedule.ts#L110-L113" }, { "kind": "interface", @@ -194244,7 +194244,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L120-L123" + "specLocation": "watcher/_types/Schedule.ts#L115-L118" }, { "kind": "interface", @@ -194296,7 +194296,7 @@ } } ], - "specLocation": "watcher/_types/Schedule.ts#L125-L129" + "specLocation": "watcher/_types/Schedule.ts#L120-L124" }, { "kind": "interface", diff --git a/specification/_global/search/_types/highlighting.ts b/specification/_global/search/_types/highlighting.ts index 7db2c925e9..df0cb0b2c0 100644 --- a/specification/_global/search/_types/highlighting.ts +++ b/specification/_global/search/_types/highlighting.ts @@ -30,19 +30,19 @@ export enum BoundaryScanner { * The `boundary_max_scan` setting controls how far to scan for boundary characters. * Only valid for the `fvh` highlighter. */ - chars = 0, + chars, /** * Break highlighted fragments at the next sentence boundary, as determined by Java’s `BreakIterator`. * You can specify the locale to use with `boundary_scanner_locale`. * When used with the `unified` highlighter, the `sentence` scanner splits sentences bigger than `fragment_size` at the first word boundary next to fragment_size. * You can set `fragment_size` to `0` to never split any sentence. */ - sentence = 1, + sentence, /** * Break highlighted fragments at the next word boundary, as determined by Java’s `BreakIterator`. * You can specify the locale to use with `boundary_scanner_locale`. */ - word = 2 + word } export class HighlightBase { @@ -156,21 +156,21 @@ export class Highlight extends HighlightBase { } export enum HighlighterEncoder { - default = 0, - html = 1 + default, + html } export enum HighlighterFragmenter { - simple = 0, - span = 1 + simple, + span } export enum HighlighterOrder { - score = 0 + score } export enum HighlighterTagsSchema { - styled = 0 + styled } /** @non_exhaustive */ @@ -178,16 +178,16 @@ export enum HighlighterType { /** * The `plain` highlighter uses the standard Lucene highlighter */ - plain = 0, + plain, /** * The fvh highlighter uses the Lucene Fast Vector highlighter. * @codegen_name fast_vector */ - fvh = 1, + fvh, /** * The unified highlighter uses the Lucene Unified Highlighter. */ - unified = 2 + unified } export class HighlightField extends HighlightBase { diff --git a/specification/_global/search/_types/hits.ts b/specification/_global/search/_types/hits.ts index 2875421a4d..4218b20259 100644 --- a/specification/_global/search/_types/hits.ts +++ b/specification/_global/search/_types/hits.ts @@ -98,9 +98,9 @@ export class TotalHits { export enum TotalHitsRelation { /** Accurate */ - eq = 0, + eq, /** Lower bound, including returned events or sequences */ - gte = 1 + gte } export class InnerHits { diff --git a/specification/_global/search/_types/rescoring.ts b/specification/_global/search/_types/rescoring.ts index 82579a1651..e144891920 100644 --- a/specification/_global/search/_types/rescoring.ts +++ b/specification/_global/search/_types/rescoring.ts @@ -53,22 +53,22 @@ export enum ScoreMode { /** * Average the original score and the rescore query score. */ - avg = 0, + avg, /** * Take the max of original score and the rescore query score. */ - max = 1, + max, /** * Take the min of the original score and the rescore query score. */ - min = 2, + min, /** * Multiply the original score by the rescore query score. * Useful for `function` query rescores. */ - multiply = 3, + multiply, /** * Add the original score and the rescore query score. */ - total = 4 + total } diff --git a/specification/_global/search/_types/suggester.ts b/specification/_global/search/_types/suggester.ts index 2c3028383e..0673c02ffd 100644 --- a/specification/_global/search/_types/suggester.ts +++ b/specification/_global/search/_types/suggester.ts @@ -470,34 +470,34 @@ export enum StringDistance { /** * Based on the Damerau-Levenshtein algorithm, but highly optimized for comparing string distance for terms inside the index. */ - internal = 0, + internal, /** * String distance algorithm based on Damerau-Levenshtein algorithm. */ - damerau_levenshtein = 1, + damerau_levenshtein, /** * String distance algorithm based on the Levenshtein edit distance algorithm. */ - levenshtein = 2, + levenshtein, /** * String distance algorithm based on Jaro-Winkler algorithm. */ - jaro_winkler = 3, + jaro_winkler, /** * String distance algorithm based on character n-grams. */ - ngram = 4 + ngram } export enum SuggestSort { /** * Sort by score first, then document frequency and then the term itself. */ - score = 0, + score, /** * Sort by document frequency first, then similarity score and then the term itself. */ - frequency = 1 + frequency } export class TermSuggester extends SuggesterBase { diff --git a/specification/_types/Geo.ts b/specification/_types/Geo.ts index c5a743ea87..9a4e0f39ab 100644 --- a/specification/_types/Geo.ts +++ b/specification/_types/Geo.ts @@ -28,35 +28,26 @@ export class DistanceParsed { export type Distance = string export enum DistanceUnit { - /** @codegen_name inches */ - in = 0, - /** @codegen_name feet */ - ft = 1, - /** @codegen_name yards */ - yd = 2, - /** @codegen_name miles */ - mi = 3, - /** @codegen_name nautic_miles */ - nmi = 4, - /** @codegen_name kilometers */ - km = 5, - /** @codegen_name meters */ - m = 6, - /** @codegen_name centimeters */ - cm = 7, - /** @codegen_name millimeters */ - mm = 8 + inches = 'in', + 'feet' = 'ft', + 'yards' = 'yd', + miles = 'mi', + nautic_miles = 'nmi', + kilometers = 'km', + meters = 'm', + centimeters = 'cm', + millimeters = 'mm' } export enum GeoDistanceType { /** * The `arc` calculation is the most accurate. */ - arc = 0, + arc, /** * The `plane` calculation is faster but less accurate. */ - plane = 1 + plane } /** A GeoJson shape, that can also use Elasticsearch's `envelope` extension. */ @@ -74,20 +65,20 @@ export enum GeoShapeRelation { /** * Return all documents whose `geo_shape` or `geo_point` field intersects the query geometry. */ - intersects = 0, + intersects, /** * Return all documents whose `geo_shape` or `geo_point` field has nothing in common with the query geometry. */ - disjoint = 1, + disjoint, /** * Return all documents whose `geo_shape` or `geo_point` field is within the query geometry. * Line geometries are not supported. */ - within = 2, + within, /** * Return all documents whose `geo_shape` or `geo_point` field contains the query geometry. */ - contains = 3 + contains } export type GeoTilePrecision = number diff --git a/specification/_types/Lifecycle.ts b/specification/_types/Lifecycle.ts index d766a26378..b44bd9a6ac 100644 --- a/specification/_types/Lifecycle.ts +++ b/specification/_types/Lifecycle.ts @@ -18,7 +18,7 @@ */ export enum LifecycleOperationMode { - RUNNING = 0, - STOPPING = 1, - STOPPED = 2 + RUNNING, + STOPPING, + STOPPED } diff --git a/specification/_types/Logging.ts b/specification/_types/Logging.ts index 14755b8a17..867a844d1a 100644 --- a/specification/_types/Logging.ts +++ b/specification/_types/Logging.ts @@ -18,9 +18,9 @@ */ export enum LogLevel { - error = 0, - warn = 1, - info = 2, - debug = 3, - trace = 4 + error, + warn, + info, + debug, + trace } diff --git a/specification/_types/Node.ts b/specification/_types/Node.ts index e5fece237e..52eb1fa8e0 100644 --- a/specification/_types/Node.ts +++ b/specification/_types/Node.ts @@ -78,20 +78,20 @@ export class RelocationFailureInfo { * @doc_id node-roles */ export enum NodeRole { - master = 0, - data = 1, - data_cold = 2, - data_content = 3, - data_frozen = 4, - data_hot = 5, - data_warm = 6, - client = 7, - ingest = 8, - ml = 9, - voting_only = 10, - transform = 11, - remote_cluster_client = 12, - coordinating_only = 13 + master, + data, + data_cold, + data_content, + data_frozen, + data_hot, + data_warm, + client, + ingest, + ml, + voting_only, + transform, + remote_cluster_client, + coordinating_only } /** diff --git a/specification/_types/Result.ts b/specification/_types/Result.ts index 200791b166..5c332da17a 100644 --- a/specification/_types/Result.ts +++ b/specification/_types/Result.ts @@ -18,10 +18,9 @@ */ export enum Result { - created = 1, - updated = 2, - deleted = 3, - not_found = 4, - /** @codegen_name no_op */ - noop = 5 + created, + updated, + deleted, + not_found, + no_op = 'noop' } diff --git a/specification/_types/Scripting.ts b/specification/_types/Scripting.ts index eceb4cdca5..51d18334e2 100644 --- a/specification/_types/Scripting.ts +++ b/specification/_types/Scripting.ts @@ -29,19 +29,19 @@ export enum ScriptLanguage { /** * Painless scripting language, purpose-built for Elasticsearch. */ - painless = 0, + painless, /** * Lucene’s expressions language, compiles a JavaScript expression to bytecode. */ - expression = 1, + expression, /** * Mustache templated, used for templates. */ - mustache = 2, + mustache, /** * Expert Java API */ - java = 3 + java } export class StoredScript { diff --git a/specification/_types/Similarity.ts b/specification/_types/Similarity.ts index 0a77021e97..f0ff5413bb 100644 --- a/specification/_types/Similarity.ts +++ b/specification/_types/Similarity.ts @@ -18,41 +18,41 @@ */ export enum DFIIndependenceMeasure { - standardized = 0, - saturated = 1, - chisquared = 2 + standardized, + saturated, + chisquared } export enum DFRAfterEffect { - no = 0, - b = 1, - l = 2 + no, + b, + l } export enum DFRBasicModel { - be = 0, - d = 1, - g = 2, - if = 3, - in = 4, - ine = 5, - p = 6 + be, + d, + g, + if, + in, + ine, + p } export enum IBDistribution { - ll = 0, - spl = 1 + ll, + spl } export enum IBLambda { - df = 0, - ttf = 1 + df, + ttf } export enum Normalization { - no = 0, - h1 = 1, - h2 = 2, - h3 = 3, - z = 4 + no, + h1, + h2, + h3, + z } diff --git a/specification/_types/Stats.ts b/specification/_types/Stats.ts index 143edc2a2f..4cd6078458 100644 --- a/specification/_types/Stats.ts +++ b/specification/_types/Stats.ts @@ -35,11 +35,11 @@ export class ClusterStatistics { } enum ClusterSearchStatus { - running = 0, - successful = 1, - partial = 2, - skipped = 3, - failed = 4 + running, + successful, + partial, + skipped, + failed } export class ClusterDetails { diff --git a/specification/_types/Time.ts b/specification/_types/Time.ts index 8a17d94947..a957c95163 100644 --- a/specification/_types/Time.ts +++ b/specification/_types/Time.ts @@ -67,18 +67,11 @@ export type DurationLarge = string export type DurationValue = Unit export enum TimeUnit { - /** @codegen_name nanoseconds */ - nanos, - /** @codegen_name microseconds */ - micros, - /** @codegen_name milliseconds */ - ms, - /** @codegen_name seconds */ - s, - /** @codegen_name minutes */ - m, - /** @codegen_name hours */ - h, - /** @codegen_name days */ - d + nanoseconds = 'nanos', + microseconds = 'micros', + milliseconds = 'ms', + seconds = 's', + minutes = 'm', + hours = 'h', + days = 'd' } diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index 8ef083408f..5183060fa4 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -100,12 +100,12 @@ export class AutoDateHistogramAggregation extends BucketAggregationBase { } export enum MinimumInterval { - second = 0, - minute = 1, - hour = 2, - day = 3, - month = 4, - year = 5 + second, + minute, + hour, + day, + month, + year } export class ChildrenAggregation extends BucketAggregationBase { @@ -344,15 +344,15 @@ export enum SamplerAggregationExecutionHint { /** * Hold field values directly. */ - map = 0, + map, /** * Hold ordinals of the field as determined by the Lucene index. */ - global_ordinals = 1, + global_ordinals, /** * Hold hashes of the field values - with potential for hash collisions. */ - bytes_hash = 2 + bytes_hash } export class FiltersAggregation extends BucketAggregationBase { @@ -981,18 +981,18 @@ export enum TermsAggregationCollectMode { /** * Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs. */ - depth_first = 0, + depth_first, /** * Caches the set of documents that fall into the uppermost buckets for subsequent replay. */ - breadth_first = 1 + breadth_first } export enum TermsAggregationExecutionHint { - map = 0, - global_ordinals = 1, - global_ordinals_hash = 2, - global_ordinals_low_cardinality = 3 + map, + global_ordinals, + global_ordinals_hash, + global_ordinals_low_cardinality } /** @codegen_names regexp, terms, partition */ diff --git a/specification/_types/aggregations/metric.ts b/specification/_types/aggregations/metric.ts index fd08f68f86..b40f7539a1 100644 --- a/specification/_types/aggregations/metric.ts +++ b/specification/_types/aggregations/metric.ts @@ -417,16 +417,16 @@ export class TopMetricsValue { export class ValueCountAggregation extends FormattableMetricAggregation {} export enum ValueType { - string = 0, - long = 1, - double = 2, - number = 3, - date = 4, - date_nanos = 5, - ip = 6, - numeric = 7, - geo_point = 8, - boolean = 9 + string, + long, + double, + number, + date, + date_nanos, + ip, + numeric, + geo_point, + boolean } export class WeightedAverageAggregation extends Aggregation { diff --git a/specification/_types/aggregations/pipeline.ts b/specification/_types/aggregations/pipeline.ts index db4e95353d..0131a5041c 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -281,10 +281,8 @@ export class HoltWintersModelSettings { type?: HoltWintersType } export enum HoltWintersType { - /** @codegen_name Additive */ - add, - /** @codegen_name Multiplicative */ - mult + Additive = 'add', + Multiplicative = 'mult' } export class MovingFunctionAggregation extends PipelineAggregationBase { diff --git a/specification/_types/aggregations/visitor.ts b/specification/_types/aggregations/visitor.ts index beb64b5e28..5ff2a80809 100644 --- a/specification/_types/aggregations/visitor.ts +++ b/specification/_types/aggregations/visitor.ts @@ -18,7 +18,7 @@ */ export enum AggregationVisitorScope { - Unknown = 0, - Aggregation = 1, - Bucket = 2 + Unknown, + Aggregation, + Bucket } diff --git a/specification/_types/analysis/icu-plugin.ts b/specification/_types/analysis/icu-plugin.ts index 8ce2741cfb..c16b9a0813 100644 --- a/specification/_types/analysis/icu-plugin.ts +++ b/specification/_types/analysis/icu-plugin.ts @@ -71,40 +71,40 @@ export class IcuAnalyzer { } export enum IcuTransformDirection { - forward = 0, - reverse = 1 + forward, + reverse } export enum IcuNormalizationMode { - decompose = 0, - compose = 1 + decompose, + compose } export enum IcuNormalizationType { - nfc = 0, - nfkc = 1, - nfkc_cf = 2 + nfc, + nfkc, + nfkc_cf } export enum IcuCollationAlternate { - shifted = 0, - 'non-ignorable' = 1 + shifted, + 'non-ignorable' } export enum IcuCollationCaseFirst { - lower = 0, - upper = 1 + lower, + upper } export enum IcuCollationDecomposition { - no = 0, - identical = 1 + no, + identical } export enum IcuCollationStrength { - primary = 0, - secondary = 1, - tertiary = 2, - quaternary = 3, - identical = 4 + primary, + secondary, + tertiary, + quaternary, + identical } diff --git a/specification/_types/analysis/kuromoji-plugin.ts b/specification/_types/analysis/kuromoji-plugin.ts index 41f3aef321..4a04242cbf 100644 --- a/specification/_types/analysis/kuromoji-plugin.ts +++ b/specification/_types/analysis/kuromoji-plugin.ts @@ -50,9 +50,9 @@ export class KuromojiStemmerTokenFilter extends TokenFilterBase { } export enum KuromojiTokenizationMode { - normal = 0, - search = 1, - extended = 2 + normal, + search, + extended } export class KuromojiTokenizer extends TokenizerBase { diff --git a/specification/_types/analysis/languages.ts b/specification/_types/analysis/languages.ts index b6ee2b1b79..44a46b9bcb 100644 --- a/specification/_types/analysis/languages.ts +++ b/specification/_types/analysis/languages.ts @@ -18,63 +18,63 @@ */ export enum Language { - Arabic = 0, - Armenian = 1, - Basque = 2, - Brazilian = 3, - Bulgarian = 4, - Catalan = 5, - Chinese = 6, - Cjk = 7, - Czech = 8, - Danish = 9, - Dutch = 10, - English = 11, - Estonian = 12, - Finnish = 13, - French = 14, - Galician = 15, - German = 16, - Greek = 17, - Hindi = 18, - Hungarian = 19, - Indonesian = 20, - Irish = 21, - Italian = 22, - Latvian = 23, - Norwegian = 24, - Persian = 25, - Portuguese = 26, - Romanian = 27, - Russian = 28, - Sorani = 29, - Spanish = 30, - Swedish = 31, - Turkish = 32, - Thai = 33 + Arabic, + Armenian, + Basque, + Brazilian, + Bulgarian, + Catalan, + Chinese, + Cjk, + Czech, + Danish, + Dutch, + English, + Estonian, + Finnish, + French, + Galician, + German, + Greek, + Hindi, + Hungarian, + Indonesian, + Irish, + Italian, + Latvian, + Norwegian, + Persian, + Portuguese, + Romanian, + Russian, + Sorani, + Spanish, + Swedish, + Turkish, + Thai } export enum SnowballLanguage { - Armenian = 0, - Basque = 1, - Catalan = 2, - Danish = 3, - Dutch = 4, - English = 5, - Finnish = 6, - French = 7, - German = 8, - German2 = 9, - Hungarian = 10, - Italian = 11, - Kp = 12, - Lovins = 13, - Norwegian = 14, - Porter = 15, - Portuguese = 16, - Romanian = 17, - Russian = 18, - Spanish = 19, - Swedish = 20, - Turkish = 21 + Armenian, + Basque, + Catalan, + Danish, + Dutch, + English, + Finnish, + French, + German, + German2, + Hungarian, + Italian, + Kp, + Lovins, + Norwegian, + Porter, + Portuguese, + Romanian, + Russian, + Spanish, + Swedish, + Turkish } diff --git a/specification/_types/analysis/phonetic-plugin.ts b/specification/_types/analysis/phonetic-plugin.ts index a88a1c864d..55e7d4f533 100644 --- a/specification/_types/analysis/phonetic-plugin.ts +++ b/specification/_types/analysis/phonetic-plugin.ts @@ -21,44 +21,44 @@ import { integer } from '@_types/Numeric' import { TokenFilterBase } from './token_filters' export enum PhoneticEncoder { - metaphone = 0, - double_metaphone = 1, - soundex = 2, - refined_soundex = 3, - caverphone1 = 4, - caverphone2 = 5, - cologne = 6, - nysiis = 7, - koelnerphonetik = 8, - haasephonetik = 9, - beider_morse = 10, - daitch_mokotoff = 11 + metaphone, + double_metaphone, + soundex, + refined_soundex, + caverphone1, + caverphone2, + cologne, + nysiis, + koelnerphonetik, + haasephonetik, + beider_morse, + daitch_mokotoff } export enum PhoneticLanguage { - any = 0, - common = 1, - cyrillic = 2, - english = 3, - french = 4, - german = 5, - hebrew = 6, - hungarian = 7, - polish = 8, - romanian = 9, - russian = 10, - spanish = 11 + any, + common, + cyrillic, + english, + french, + german, + hebrew, + hungarian, + polish, + romanian, + russian, + spanish } export enum PhoneticNameType { - generic = 0, - ashkenazi = 1, - sephardic = 2 + generic, + ashkenazi, + sephardic } export enum PhoneticRuleType { - approx = 0, - exact = 1 + approx, + exact } export class PhoneticTokenFilter extends TokenFilterBase { diff --git a/specification/_types/analysis/token_filters.ts b/specification/_types/analysis/token_filters.ts index 2aca0e28df..3812fffd84 100644 --- a/specification/_types/analysis/token_filters.ts +++ b/specification/_types/analysis/token_filters.ts @@ -60,9 +60,9 @@ export class HyphenationDecompounderTokenFilter extends CompoundWordTokenFilterB } export enum DelimitedPayloadEncoding { - int = 0, - float = 1, - identity = 2 + int, + float, + identity } export class DelimitedPayloadTokenFilter extends TokenFilterBase { @@ -72,8 +72,8 @@ export class DelimitedPayloadTokenFilter extends TokenFilterBase { } export enum EdgeNGramSide { - front = 0, - back = 1 + front, + back } export class EdgeNGramTokenFilter extends TokenFilterBase { @@ -103,8 +103,8 @@ export class StopTokenFilter extends TokenFilterBase { } export enum SynonymFormat { - solr = 0, - wordnet = 1 + solr, + wordnet } export class SynonymGraphTokenFilter extends TokenFilterBase { @@ -211,8 +211,8 @@ export class JaStopTokenFilter extends TokenFilterBase { } export enum KeepTypesMode { - include = 0, - exclude = 1 + include, + exclude } export class KeepTypesTokenFilter extends TokenFilterBase { diff --git a/specification/_types/analysis/tokenizers.ts b/specification/_types/analysis/tokenizers.ts index 5eda956f0b..5dd7546606 100644 --- a/specification/_types/analysis/tokenizers.ts +++ b/specification/_types/analysis/tokenizers.ts @@ -45,12 +45,12 @@ export class NGramTokenizer extends TokenizerBase { } export enum TokenChar { - letter = 0, - digit = 1, - whitespace = 2, - punctuation = 3, - symbol = 4, - custom = 5 + letter, + digit, + whitespace, + punctuation, + symbol, + custom } export class CharGroupTokenizer extends TokenizerBase { @@ -73,9 +73,9 @@ export class LowercaseTokenizer extends TokenizerBase { } export enum NoriDecompoundMode { - discard = 0, - none = 1, - mixed = 2 + discard, + none, + mixed } export class NoriTokenizer extends TokenizerBase { diff --git a/specification/_types/common.ts b/specification/_types/common.ts index 05be05220c..8edb768f9a 100644 --- a/specification/_types/common.ts +++ b/specification/_types/common.ts @@ -107,18 +107,18 @@ export enum VersionType { /** * Use internal versioning that starts at 1 and increments with each update or delete. */ - internal = 0, + internal, /** * Only index the document if the given version is strictly higher than the version of the stored document or if there is no existing document. */ - external = 1, + external, /** * Only index the document if the given version is equal or higher than the version of the stored document or if there is no existing document. * Note: the external_gte version type is meant for special use cases and should be used with care. * If used incorrectly, it can result in loss of data. */ - external_gte = 2, - force = 3 + external_gte, + force } // TODO: replace all uuid's with this type @@ -172,29 +172,23 @@ export type MinimumShouldMatch = integer | string * @doc_id byte-units */ export enum Bytes { - /** @codegen_name bytes */ - b, - /** @codegen_name kilo_bytes */ - kb, - /** @codegen_name mega_bytes */ - mb, - /** @codegen_name giga_bytes */ - gb, - /** @codegen_name tera_bytes */ - tb, - /** @codegen_name peta_bytes */ - pb + bytes = 'b', + kilo_bytes = 'kb', + mega_bytes = 'mb', + giga_bytes = 'gb', + tera_bytes = 'tb', + peta_bytes = 'pb' } export enum Conflicts { /** * Stop reindexing if there are conflicts. */ - abort = 0, + abort, /** * Continue reindexing even if there are conflicts. */ - proceed = 1 + proceed } export type Username = string @@ -209,15 +203,15 @@ export class ElasticsearchUrlFormatter {} */ export enum ExpandWildcard { /** Match any data stream or index, including hidden ones. */ - all = 0, + all, /** Match open, non-hidden indices. Also matches any non-hidden data stream. */ - open = 1, + open, /** Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. */ - closed = 2, + closed, /** Match hidden data streams and hidden indices. Must be combined with open, closed, or both. */ - hidden = 3, + hidden, /** Wildcard expressions are not accepted. */ - none = 4 + none } export type ExpandWildcards = ExpandWildcard | ExpandWildcard[] @@ -231,42 +225,42 @@ export enum HealthStatus { * All shards are assigned. * @aliases GREEN */ - green = 0, + green, /** * All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired. * @aliases YELLOW */ - yellow = 1, + yellow, /** * One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned. * @aliases RED */ - red = 2 + red } export enum HttpMethod { - GET = 0, - POST = 1, - PUT = 2, - DELETE = 3, - HEAD = 4 + GET, + POST, + PUT, + DELETE, + HEAD } export enum Level { - cluster = 0, - indices = 1, - shards = 2 + cluster, + indices, + shards } export enum OpType { /** * Overwrite any documents that already exist. */ - index = 0, + index, /** * Only index documents that do not already exist. */ - create = 1 + create } /** @@ -280,24 +274,24 @@ export enum Refresh { export enum SearchType { /** Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate. */ - query_then_fetch = 0, + query_then_fetch, /** Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate. */ - dfs_query_then_fetch = 1 + dfs_query_then_fetch } export enum SuggestMode { /** * Only generate suggestions for terms that are not in the shard. */ - missing = 0, + missing, /** * Only suggest terms that occur in more docs on the shard than the original term. */ - popular = 1, + popular, /** * Suggest any matching suggestions based on terms in the suggest text. */ - always = 2 + always } export enum ThreadType { @@ -315,12 +309,12 @@ export enum WaitForActiveShardOptions { } export enum WaitForEvents { - immediate = 0, - urgent = 1, - high = 2, - normal = 3, - low = 4, - languid = 5 + immediate, + urgent, + high, + normal, + low, + languid } // Additional properties are the meta fields diff --git a/specification/_types/mapping/RuntimeFields.ts b/specification/_types/mapping/RuntimeFields.ts index 477c9323af..de3a0e9e33 100644 --- a/specification/_types/mapping/RuntimeFields.ts +++ b/specification/_types/mapping/RuntimeFields.ts @@ -54,12 +54,12 @@ export class RuntimeFieldFetchFields { } export enum RuntimeFieldType { - boolean = 0, - date = 1, - double = 2, - geo_point = 3, - ip = 4, - keyword = 5, - long = 6, + boolean, + date, + double, + geo_point, + ip, + keyword, + long, lookup } diff --git a/specification/_types/mapping/dynamic-template.ts b/specification/_types/mapping/dynamic-template.ts index 30e005226b..baf04bf7c5 100644 --- a/specification/_types/mapping/dynamic-template.ts +++ b/specification/_types/mapping/dynamic-template.ts @@ -30,8 +30,8 @@ export class DynamicTemplate { } export enum MatchType { - simple = 0, - regex = 1 + simple, + regex } /** diff --git a/specification/_types/mapping/geo.ts b/specification/_types/mapping/geo.ts index c0cca8f63a..e8b5ff9751 100644 --- a/specification/_types/mapping/geo.ts +++ b/specification/_types/mapping/geo.ts @@ -50,13 +50,13 @@ export class GeoShapeProperty extends DocValuesPropertyBase { } export enum GeoStrategy { - recursive = 0, - term = 1 + recursive, + term } export enum GeoTree { - geohash = 0, - quadtree = 1 + geohash, + quadtree } export class PointProperty extends DocValuesPropertyBase { diff --git a/specification/_types/query_dsl/RewriteMultiTerm.ts b/specification/_types/query_dsl/RewriteMultiTerm.ts index 20ef092380..282e7dfadd 100644 --- a/specification/_types/query_dsl/RewriteMultiTerm.ts +++ b/specification/_types/query_dsl/RewriteMultiTerm.ts @@ -18,10 +18,10 @@ */ export enum RewriteMultiTerm { - constant_score = 0, - scoring_boolean = 1, - constant_score_boolean = 2, - top_terms_N = 3, - top_terms_boost_N = 4, - top_terms_blended_freqs_N = 5 + constant_score, + scoring_boolean, + constant_score_boolean, + top_terms_N, + top_terms_boost_N, + top_terms_blended_freqs_N } diff --git a/specification/_types/query_dsl/VisitorScope.ts b/specification/_types/query_dsl/VisitorScope.ts index 688a010367..51dda097cc 100644 --- a/specification/_types/query_dsl/VisitorScope.ts +++ b/specification/_types/query_dsl/VisitorScope.ts @@ -18,13 +18,13 @@ */ export enum VisitorScope { - Unknown = 0, - Query = 1, - Filter = 2, - Must = 3, - MustNot = 4, - Should = 5, - PositiveQuery = 6, - NegativeQuery = 7, - Span = 8 + Unknown, + Query, + Filter, + Must, + MustNot, + Should, + PositiveQuery, + NegativeQuery, + Span } diff --git a/specification/_types/query_dsl/compound.ts b/specification/_types/query_dsl/compound.ts index b3a7d20175..3e18821d51 100644 --- a/specification/_types/query_dsl/compound.ts +++ b/specification/_types/query_dsl/compound.ts @@ -244,117 +244,117 @@ export enum FunctionScoreMode { /** * Scores are multiplied. */ - multiply = 0, + multiply, /** * Scores are summed. */ - sum = 1, + sum, /** * Scores are averaged. */ - avg = 2, + avg, /** * The first function that has a matching filter is applied. */ - first = 3, + first, /** * Maximum score is used. */ - max = 4, + max, /** * Minimum score is used. */ - min = 5 + min } export enum FunctionBoostMode { /** * Query score and function score are multiplied */ - multiply = 0, + multiply, /** * Only the function score is used. * The query score is ignored. */ - replace = 1, + replace, /** * Query score and function score are added */ - sum = 2, + sum, /** * Query score and function score are averaged */ - avg = 3, + avg, /** * Max of query score and function score */ - max = 4, + max, /** * Min of query score and function score */ - min = 5 + min } export enum FieldValueFactorModifier { /** * Do not apply any multiplier to the field value. */ - none = 0, + none, /** * Take the common logarithm of the field value. * Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `log1p` instead. */ - log = 1, + log, /** * Add 1 to the field value and take the common logarithm. */ - log1p = 2, + log1p, /** * Add 2 to the field value and take the common logarithm. */ - log2p = 3, + log2p, /** * Take the natural logarithm of the field value. * Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `ln1p` instead. */ - ln = 4, + ln, /** * Add 1 to the field value and take the natural logarithm. */ - ln1p = 5, + ln1p, /** * Add 2 to the field value and take the natural logarithm. */ - ln2p = 6, + ln2p, /** * Square the field value (multiply it by itself). */ - square = 7, + square, /** * Take the square root of the field value. */ - sqrt = 8, + sqrt, /** * Reciprocate the field value, same as `1/x` where `x` is the field’s value. */ - reciprocal = 9 + reciprocal } export enum MultiValueMode { /** * Distance is the minimum distance. */ - min = 0, + min, /** * Distance is the maximum distance. */ - max = 1, + max, /** * Distance is the average distance. */ - avg = 2, + avg, /** * Distance is the sum of all distances. */ - sum = 3 + sum } diff --git a/specification/_types/query_dsl/fulltext.ts b/specification/_types/query_dsl/fulltext.ts index 8ced9fd18d..2bc86cb25b 100644 --- a/specification/_types/query_dsl/fulltext.ts +++ b/specification/_types/query_dsl/fulltext.ts @@ -542,39 +542,39 @@ export enum TextQueryType { /** * Finds documents that match any field, but uses the `_score` from the best field. */ - best_fields = 0, + best_fields, /** * Finds documents that match any field and combines the `_score` from each field. */ - most_fields = 1, + most_fields, /** * Treats fields with the same analyzer as though they were one big field. * Looks for each word in any field. */ - cross_fields = 2, + cross_fields, /** * Runs a `match_phrase` query on each field and uses the `_score` from the best field. */ - phrase = 3, + phrase, /** * Runs a `match_phrase_prefix` query on each field and uses the `_score` from the best field. */ - phrase_prefix = 4, + phrase_prefix, /** * Creates a `match_bool_prefix` query on each field and combines the `_score` from each field. */ - bool_prefix = 5 + bool_prefix } export enum ZeroTermsQuery { /** * Returns all documents, similar to a `match_all` query. */ - all = 0, + all, /** * No documents are returned if the `analyzer` removes all tokens. */ - none = 1 + none } export class QueryStringQuery extends QueryBase { @@ -709,57 +709,57 @@ export enum SimpleQueryStringFlag { /** * Disables all operators. */ - NONE = 0, + NONE, /** * Enables the `+` AND operator. */ - AND = 1 << 0, + AND, /** * Enables the `-` NOT operator. */ - NOT = 1 << 1, + NOT, /** * Enables the `\|` OR operator. */ - OR = 1 << 2, + OR, /** * Enables the `*` prefix operator. */ - PREFIX = 1 << 3, + PREFIX, /** * Enables the `"` quotes operator used to search for phrases. */ - PHRASE = 1 << 4, + PHRASE, /** * Enables the `(` and `)` operators to control operator precedence. */ - PRECEDENCE = 1 << 5, + PRECEDENCE, /** * Enables `\` as an escape character. */ - ESCAPE = 1 << 6, + ESCAPE, /** * Enables whitespace as split characters. */ - WHITESPACE = 1 << 7, + WHITESPACE, /** * Enables the `~N` operator after a word, where `N` is an integer denoting the allowed edit distance for matching. */ - FUZZY = 1 << 8, + FUZZY, /** * Enables the `~N` operator, after a phrase where `N` is the maximum number of positions allowed between matching tokens. * Synonymous to `SLOP`. */ - NEAR = 1 << 9, + NEAR, /** * Enables the `~N` operator, after a phrase where `N` is maximum number of positions allowed between matching tokens. * Synonymous to `NEAR`. */ - SLOP = 1 << 9, + SLOP, /** * Enables all optional operators. */ - ALL = -1 + ALL } export class SimpleQueryStringQuery extends QueryBase { diff --git a/specification/_types/query_dsl/geo.ts b/specification/_types/query_dsl/geo.ts index 32539f18d3..6cc868e734 100644 --- a/specification/_types/query_dsl/geo.ts +++ b/specification/_types/query_dsl/geo.ts @@ -50,8 +50,8 @@ export class GeoBoundingBoxQuery } export enum GeoExecution { - memory = 0, - indexed = 1 + memory, + indexed } export class GeoDistanceQuery @@ -93,8 +93,8 @@ export class GeoPolygonQuery } export enum GeoFormat { - GeoJson = 0, - WellKnownText = 1 + GeoJson, + WellKnownText } export class GeoShapeFieldQuery { @@ -125,27 +125,27 @@ export class GeoShapeQuery } export enum CharacterType { - Whitespace = 0, - Alpha = 1, - Comment = 2 + Whitespace, + Alpha, + Comment } export enum TokenType { - None = 0, - Word = 1, - LParen = 2, - RParen = 3, - Comma = 4 + None, + Word, + LParen, + RParen, + Comma } export enum GeoValidationMethod { /** * Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates. */ - coerce = 0, + coerce, /** * Accept geo points with invalid latitude or longitude. */ - ignore_malformed = 1, - strict = 2 + ignore_malformed, + strict } diff --git a/specification/_types/query_dsl/joining.ts b/specification/_types/query_dsl/joining.ts index efe4d6ae10..d5454b6559 100644 --- a/specification/_types/query_dsl/joining.ts +++ b/specification/_types/query_dsl/joining.ts @@ -27,15 +27,15 @@ import { QueryBase, QueryContainer } from './abstractions' */ export enum ChildScoreMode { /* Do no scoring. */ - none = 0, + none, /* Parent hit's score is the average of all child scores. */ - avg = 1, + avg, /* Parent hit's score is the max of all child scores. */ - sum = 2, + sum, /* Parent hit's score is the sum of all child scores. */ - max = 3, + max, /* Parent hit's score is the min of all child scores. */ - min = 4 + min } export class HasChildQuery extends QueryBase { diff --git a/specification/_types/query_dsl/term.ts b/specification/_types/query_dsl/term.ts index e104cf0add..6ebd7c0064 100644 --- a/specification/_types/query_dsl/term.ts +++ b/specification/_types/query_dsl/term.ts @@ -171,15 +171,15 @@ export enum RangeRelation { /** * Matches documents with a range field value entirely within the query’s range. */ - within = 0, + within, /** * Matches documents with a range field value that entirely contains the query’s range. */ - contains = 1, + contains, /** * Matches documents with a range field value that intersects the query’s range. */ - intersects = 2 + intersects } /** @shortcut_property value */ diff --git a/specification/_types/sort.ts b/specification/_types/sort.ts index 9d470d17f4..d320da8b99 100644 --- a/specification/_types/sort.ts +++ b/specification/_types/sort.ts @@ -35,10 +35,10 @@ export class NestedSortValue { } export enum FieldSortNumericType { - long = 0, - double = 1, - date = 2, - date_nanos = 3 + long, + double, + date, + date_nanos } /** @shortcut_property order */ @@ -104,20 +104,20 @@ export type SortResults = FieldValue[] * Defines what values to pick in the case a document contains multiple values for a particular field. */ export enum SortMode { - min = 0, - max = 1, - sum = 2, - avg = 3, - median = 4 + min, + max, + sum, + avg, + median } export enum SortOrder { /** * Ascending (smallest to largest) */ - asc = 0, + asc, /** * Descending (largest to smallest) */ - desc = 1 + desc } diff --git a/specification/cat/transforms/types.ts b/specification/cat/transforms/types.ts index 57d93e3dc1..f5f14fc5a9 100644 --- a/specification/cat/transforms/types.ts +++ b/specification/cat/transforms/types.ts @@ -197,15 +197,15 @@ export class TransformsRecord { } export enum TransformState { - STARTED = 0, - INDEXING = 1, - ABORTING = 2, - STOPPING = 3, - STOPPED = 4, - FAILED = 5 + STARTED, + INDEXING, + ABORTING, + STOPPING, + STOPPED, + FAILED } export enum TransformType { - batch = 0, - continuous = 1 + batch, + continuous } diff --git a/specification/ccr/follow_info/types.ts b/specification/ccr/follow_info/types.ts index 891ccabbf2..92fbe40f01 100644 --- a/specification/ccr/follow_info/types.ts +++ b/specification/ccr/follow_info/types.ts @@ -28,8 +28,8 @@ export class FollowerIndex { } export enum FollowerIndexStatus { - active = 0, - paused = 1 + active, + paused } import { integer } from '@_types/Numeric' diff --git a/specification/cluster/allocation_explain/types.ts b/specification/cluster/allocation_explain/types.ts index d9e9212af2..a0978da920 100644 --- a/specification/cluster/allocation_explain/types.ts +++ b/specification/cluster/allocation_explain/types.ts @@ -30,10 +30,10 @@ export class AllocationDecision { } export enum AllocationExplainDecision { - NO = 0, - YES = 1, - THROTTLE = 2, - ALWAYS = 3 + NO, + YES, + THROTTLE, + ALWAYS } export class AllocationStore { @@ -84,14 +84,14 @@ export class CurrentNode { } export enum Decision { - yes = 0, - no = 1, - worse_balance = 2, - throttled = 3, - awaiting_info = 4, - allocation_delayed = 5, - no_valid_shard_copy = 6, - no_attempt = 7 + yes, + no, + worse_balance, + throttled, + awaiting_info, + allocation_delayed, + no_valid_shard_copy, + no_attempt } export class NodeAllocationExplanation { @@ -106,12 +106,12 @@ export class NodeAllocationExplanation { } export enum StoreCopy { - NONE = 0, - AVAILABLE = 1, - CORRUPT = 2, - IO_ERROR = 3, - STALE = 4, - UNKNOWN = 5 + NONE, + AVAILABLE, + CORRUPT, + IO_ERROR, + STALE, + UNKNOWN } export class UnassignedInformation { @@ -128,19 +128,19 @@ export class UnassignedInformation { * @doc_id cat-shards */ export enum UnassignedInformationReason { - INDEX_CREATED = 0, - CLUSTER_RECOVERED = 1, - INDEX_REOPENED = 2, - DANGLING_INDEX_IMPORTED = 3, - NEW_INDEX_RESTORED = 4, - EXISTING_INDEX_RESTORED = 5, - REPLICA_ADDED = 6, - ALLOCATION_FAILED = 7, - NODE_LEFT = 8, - REROUTE_CANCELLED = 9, - REINITIALIZED = 10, - REALLOCATED_REPLICA = 11, - PRIMARY_FAILED = 12, - FORCED_EMPTY_PRIMARY = 13, - MANUAL_ALLOCATION = 14 + INDEX_CREATED, + CLUSTER_RECOVERED, + INDEX_REOPENED, + DANGLING_INDEX_IMPORTED, + NEW_INDEX_RESTORED, + EXISTING_INDEX_RESTORED, + REPLICA_ADDED, + ALLOCATION_FAILED, + NODE_LEFT, + REROUTE_CANCELLED, + REINITIALIZED, + REALLOCATED_REPLICA, + PRIMARY_FAILED, + FORCED_EMPTY_PRIMARY, + MANUAL_ALLOCATION } diff --git a/specification/enrich/execute_policy/types.ts b/specification/enrich/execute_policy/types.ts index 6e1a92fa34..9a9a21b011 100644 --- a/specification/enrich/execute_policy/types.ts +++ b/specification/enrich/execute_policy/types.ts @@ -22,8 +22,8 @@ export class ExecuteEnrichPolicyStatus { } export enum EnrichPolicyPhase { - SCHEDULED = 0, - RUNNING = 1, - COMPLETE = 2, - FAILED = 3 + SCHEDULED, + RUNNING, + COMPLETE, + FAILED } diff --git a/specification/eql/search/types.ts b/specification/eql/search/types.ts index 1a22b2c358..fa1aae118a 100644 --- a/specification/eql/search/types.ts +++ b/specification/eql/search/types.ts @@ -24,9 +24,9 @@ export enum ResultPosition { /** * Return the most recent matches, similar to the Unix tail command. */ - tail = 0, + tail, /** * Return the earliest matches, similar to the Unix head command. */ - head = 1 + head } diff --git a/specification/indices/_types/DataStream.ts b/specification/indices/_types/DataStream.ts index dfca2e64d2..58c88f0ad7 100644 --- a/specification/indices/_types/DataStream.ts +++ b/specification/indices/_types/DataStream.ts @@ -30,14 +30,10 @@ import { integer } from '@_types/Numeric' import { DataStreamLifecycleWithRollover } from '@indices/_types/DataStreamLifecycle' enum ManagedBy { - /** @codegen_name ilm */ - 'Index Lifecycle Management', - /** @codegen_name datastream */ - // This should have been written with capital letters, it's a known typo and should not be corrected, - // since the test cases have already been written. - 'Data stream lifecycle', - /** @codegen_name unmanaged */ - 'Unmanaged' + ilm = 'Index Lifecycle Management', + // This should have been written with capital letters, it's a known typo and should not be corrected. + datastream = 'Data stream lifecycle', + unmanaged = 'Unmanaged' } export class DataStream { diff --git a/specification/indices/_types/FielddataLoading.ts b/specification/indices/_types/FielddataLoading.ts index f2e89bea6f..8351d46182 100644 --- a/specification/indices/_types/FielddataLoading.ts +++ b/specification/indices/_types/FielddataLoading.ts @@ -18,6 +18,6 @@ */ export enum FielddataLoading { - eager = 0, - eager_global_ordinals = 1 + eager, + eager_global_ordinals } diff --git a/specification/indices/_types/GeoPointFielddataFormat.ts b/specification/indices/_types/GeoPointFielddataFormat.ts index d084121354..d04c696c0c 100644 --- a/specification/indices/_types/GeoPointFielddataFormat.ts +++ b/specification/indices/_types/GeoPointFielddataFormat.ts @@ -18,8 +18,8 @@ */ export enum GeoPointFielddataFormat { - array = 0, - doc_values = 1, - compressed = 2, - disabled = 3 + array, + doc_values, + compressed, + disabled } diff --git a/specification/indices/_types/IndexRouting.ts b/specification/indices/_types/IndexRouting.ts index 16f5e9235a..32db133db0 100644 --- a/specification/indices/_types/IndexRouting.ts +++ b/specification/indices/_types/IndexRouting.ts @@ -36,17 +36,17 @@ export class IndexRoutingRebalance { } export enum IndexRoutingAllocationOptions { - all = 0, - primaries = 1, - new_primaries = 2, - none = 3 + all, + primaries, + new_primaries, + none } export enum IndexRoutingRebalanceOptions { - all = 0, - primaries = 1, - replicas = 2, - none = 3 + all, + primaries, + replicas, + none } export class IndexRoutingAllocationInclude { diff --git a/specification/indices/_types/IndexSegmentSort.ts b/specification/indices/_types/IndexSegmentSort.ts index 560fdf8269..1aaff82529 100644 --- a/specification/indices/_types/IndexSegmentSort.ts +++ b/specification/indices/_types/IndexSegmentSort.ts @@ -41,8 +41,6 @@ export enum SegmentSortMode { } export enum SegmentSortMissing { - /** @codegen_name last */ - '_last', - /** @codegen_name first */ - '_first' + last = '_last', + first = '_first' } diff --git a/specification/indices/_types/NumericFielddataFormat.ts b/specification/indices/_types/NumericFielddataFormat.ts index ae4d651639..1d04e6a535 100644 --- a/specification/indices/_types/NumericFielddataFormat.ts +++ b/specification/indices/_types/NumericFielddataFormat.ts @@ -18,6 +18,6 @@ */ export enum NumericFielddataFormat { - array = 0, - disabled = 1 + array, + disabled } diff --git a/specification/indices/_types/StringFielddataFormat.ts b/specification/indices/_types/StringFielddataFormat.ts index 3b4c6a2f34..8823893fe9 100644 --- a/specification/indices/_types/StringFielddataFormat.ts +++ b/specification/indices/_types/StringFielddataFormat.ts @@ -18,6 +18,6 @@ */ export enum StringFielddataFormat { - paged_bytes = 0, - disabled = 1 + paged_bytes, + disabled } diff --git a/specification/indices/add_block/IndicesAddBlockRequest.ts b/specification/indices/add_block/IndicesAddBlockRequest.ts index d07127c1c0..3f017f72be 100644 --- a/specification/indices/add_block/IndicesAddBlockRequest.ts +++ b/specification/indices/add_block/IndicesAddBlockRequest.ts @@ -41,8 +41,8 @@ export interface Request extends RequestBase { } export enum IndicesBlockOptions { - metadata = 0, - read = 1, - read_only = 2, - write = 3 + metadata, + read, + read_only, + write } diff --git a/specification/indices/shard_stores/types.ts b/specification/indices/shard_stores/types.ts index 660e5b1144..4ca0367dd8 100644 --- a/specification/indices/shard_stores/types.ts +++ b/specification/indices/shard_stores/types.ts @@ -43,9 +43,9 @@ export class ShardStoreNode { } export enum ShardStoreAllocation { - primary = 0, - replica = 1, - unused = 2 + primary, + replica, + unused } export class ShardStoreException { @@ -59,11 +59,11 @@ export class ShardStoreWrapper { export enum ShardStoreStatus { /** The primary shard and all replica shards are assigned. */ - green = 0, + green, /** One or more replica shards are unassigned. */ - yellow = 1, + yellow, /** The primary shard is unassigned. */ - red = 2, + red, /** Return all shards, regardless of health status. */ - all = 3 + all } diff --git a/specification/inference/_types/TaskType.ts b/specification/inference/_types/TaskType.ts index cb1556f47e..c7c2e42a84 100644 --- a/specification/inference/_types/TaskType.ts +++ b/specification/inference/_types/TaskType.ts @@ -21,6 +21,6 @@ * Task types used in the API */ export enum TaskType { - sparse_embedding = 0, - text_embedding = 1 + sparse_embedding, + text_embedding } diff --git a/specification/ingest/_types/Pipeline.ts b/specification/ingest/_types/Pipeline.ts index 178717b507..da8a19de91 100644 --- a/specification/ingest/_types/Pipeline.ts +++ b/specification/ingest/_types/Pipeline.ts @@ -46,16 +46,16 @@ export class Pipeline { // Unused .. but let's keep it for now export enum PipelineFailure { - BadAuthentication = 0, - BadResponse = 1, - PingFailure = 2, - SniffFailure = 3, - CouldNotStartSniffOnStartup = 4, - MaxTimeoutReached = 5, - MaxRetriesReached = 6, - Unexpected = 7, - BadRequest = 8, - NoNodesAttempted = 9 + BadAuthentication, + BadResponse, + PingFailure, + SniffFailure, + CouldNotStartSniffOnStartup, + MaxTimeoutReached, + MaxRetriesReached, + Unexpected, + BadRequest, + NoNodesAttempted } export class PipelineConfig { diff --git a/specification/ingest/_types/Processors.ts b/specification/ingest/_types/Processors.ts index afc9059552..1429def342 100644 --- a/specification/ingest/_types/Processors.ts +++ b/specification/ingest/_types/Processors.ts @@ -258,16 +258,16 @@ export class ProcessorBase { } export enum UserAgentProperty { - NAME = 0, - MAJOR = 1, - MINOR = 2, - PATCH = 3, - OS = 4, - OS_NAME = 5, - OS_MAJOR = 6, - OS_MINOR = 7, - DEVICE = 8, - BUILD = 9 + NAME, + MAJOR, + MINOR, + PATCH, + OS, + OS_NAME, + OS_MAJOR, + OS_MINOR, + DEVICE, + BUILD } export class AppendProcessor extends ProcessorBase { @@ -422,13 +422,13 @@ export class CircleProcessor extends ProcessorBase { } export enum ConvertType { - integer = 0, - long = 1, - float = 2, - double = 3, - string = 4, - boolean = 5, - auto = 6 + integer, + long, + float, + double, + string, + boolean, + auto } export class ConvertProcessor extends ProcessorBase { @@ -1027,8 +1027,8 @@ export class SetSecurityUserProcessor extends ProcessorBase { } export enum ShapeType { - geo_shape = 0, - shape = 1 + geo_shape, + shape } export class SortProcessor extends ProcessorBase { diff --git a/specification/license/_types/License.ts b/specification/license/_types/License.ts index d88ee69718..1579b12780 100644 --- a/specification/license/_types/License.ts +++ b/specification/license/_types/License.ts @@ -21,22 +21,22 @@ import { long } from '@_types/Numeric' import { EpochTime, UnitMillis } from '@_types/Time' export enum LicenseType { - missing = 0, - trial = 1, - basic = 2, - standard = 3, - dev = 4, - silver = 5, - gold = 6, - platinum = 7, - enterprise = 8 + missing, + trial, + basic, + standard, + dev, + silver, + gold, + platinum, + enterprise } export enum LicenseStatus { - active = 0, - valid = 1, - invalid = 2, - expired = 3 + active, + valid, + invalid, + expired } export class License { diff --git a/specification/migration/deprecations/types.ts b/specification/migration/deprecations/types.ts index 036291609f..bc42d1ece4 100644 --- a/specification/migration/deprecations/types.ts +++ b/specification/migration/deprecations/types.ts @@ -18,12 +18,12 @@ */ export enum DeprecationLevel { - none = 0, - info = 1, + none, + info, /** You can upgrade directly, but you are using deprecated functionality which will not be available or behave differently in the next major version. */ - warning = 2, + warning, /** You cannot upgrade without fixing this problem. */ - critical = 3 + critical } export class Deprecation { diff --git a/specification/ml/_types/Dataframe.ts b/specification/ml/_types/Dataframe.ts index 1cf8f3c390..dc9f7f66af 100644 --- a/specification/ml/_types/Dataframe.ts +++ b/specification/ml/_types/Dataframe.ts @@ -18,9 +18,9 @@ */ export enum DataframeState { - started = 0, - stopped = 1, - starting = 2, - stopping = 3, - failed = 4 + started, + stopped, + starting, + stopping, + failed } diff --git a/specification/ml/_types/Detector.ts b/specification/ml/_types/Detector.ts index b97202470e..205031d14d 100644 --- a/specification/ml/_types/Detector.ts +++ b/specification/ml/_types/Detector.ts @@ -125,8 +125,8 @@ export class DetectorRead implements OverloadOf { } export enum ExcludeFrequent { - all = 0, - none = 1, - by = 2, - over = 3 + all, + none, + by, + over } diff --git a/specification/ml/_types/Functions.ts b/specification/ml/_types/Functions.ts index ae2e00c963..f066c61c80 100644 --- a/specification/ml/_types/Functions.ts +++ b/specification/ml/_types/Functions.ts @@ -18,61 +18,61 @@ */ export enum CountFunction { - Count = 0, - HighCount = 1, - LowCount = 2 + Count, + HighCount, + LowCount } export enum DistinctCountFunction { - DistinctCount = 0, - LowDistinctCount = 1, - HighDistinctCount = 2 + DistinctCount, + LowDistinctCount, + HighDistinctCount } export enum GeographicFunction { - LatLong = 0 + LatLong } export enum InfoContentFunction { - InfoContent = 0, - HighInfoContent = 1, - LowInfoContent = 2 + InfoContent, + HighInfoContent, + LowInfoContent } export enum MetricFunction { - Min = 0, - Max = 1, - Median = 2, - HighMedian = 3, - LowMedian = 4, - Mean = 5, - HighMean = 6, - LowMean = 7, - Metric = 8, - Varp = 9, - HighVarp = 10, - LowVarp = 11 + Min, + Max, + Median, + HighMedian, + LowMedian, + Mean, + HighMean, + LowMean, + Metric, + Varp, + HighVarp, + LowVarp } export enum NonNullSumFunction { - NonNullSum = 0, - HighNonNullSum = 1, - LowNonNullSum = 2 + NonNullSum, + HighNonNullSum, + LowNonNullSum } export enum NonZeroCountFunction { - NonZeroCount = 0, - LowNonZeroCount = 1, - HighNonZeroCount = 2 + NonZeroCount, + LowNonZeroCount, + HighNonZeroCount } export enum RareFunction { - Rare = 0, - FreqRare = 1 + Rare, + FreqRare } export enum SumFunction { - Sum = 0, - HighSum = 1, - LowSum = 2 + Sum, + HighSum, + LowSum } diff --git a/specification/ml/_types/Job.ts b/specification/ml/_types/Job.ts index e090f1cf20..4d7376ccfc 100644 --- a/specification/ml/_types/Job.ts +++ b/specification/ml/_types/Job.ts @@ -35,20 +35,20 @@ import { Datafeed, DatafeedConfig } from '@ml/_types/Datafeed' export enum JobState { /** The job close action is in progress and has not yet completed. A closing job cannot accept further data. */ - closing = 0, + closing, /** The job finished successfully with its model state persisted. The job must be opened before it can accept further data. */ - closed = 1, + closed, /** The job is available to receive and process data. */ - opened = 2, + opened, /** * The job did not finish successfully due to an error. * This situation can occur due to invalid input data, a fatal error occurring during the analysis, or an external interaction such as the process being killed by the Linux out of memory (OOM) killer. * If the job had irrevocably failed, it must be force closed and then deleted. * If the datafeed can be corrected, the job can be closed and then re-opened. */ - failed = 3, + failed, /** The job open action is in progress and has not yet completed. */ - opening = 4 + opening } export class JobStatistics { @@ -395,7 +395,7 @@ export class JobBlocked { } export enum JobBlockedReason { - delete = 0, - reset = 1, - revert = 2 + delete, + reset, + revert } diff --git a/specification/ml/_types/Rule.ts b/specification/ml/_types/Rule.ts index 7c2435fbec..ef497f8a45 100644 --- a/specification/ml/_types/Rule.ts +++ b/specification/ml/_types/Rule.ts @@ -42,11 +42,11 @@ export enum RuleAction { /** * The result will not be created. Unless you also specify `skip_model_update`, the model will be updated as usual with the corresponding series value. */ - skip_result = 0, + skip_result, /** * The value for that series will not be used to update the model. Unless you also specify `skip_result`, the results will be created as usual. This action is suitable when certain values are expected to be consistently anomalous and they affect the model in a way that negatively impacts the rest of the results. */ - skip_model_update = 1 + skip_model_update } export class RuleCondition { @@ -65,15 +65,15 @@ export class RuleCondition { } export enum AppliesTo { - actual = 0, - typical = 1, - diff_from_typical = 2, - time = 3 + actual, + typical, + diff_from_typical, + time } export enum ConditionOperator { - gt = 0, - gte = 1, - lt = 2, - lte = 3 + gt, + gte, + lt, + lte } diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index 21262132ff..acd5c0c64e 100644 --- a/specification/ml/_types/TrainedModel.ts +++ b/specification/ml/_types/TrainedModel.ts @@ -275,30 +275,30 @@ export enum DeploymentState { /** * The deployment is usable; at least one node has the model allocated. */ - started = 0, + started, /** * The deployment has recently started but is not yet usable; the model is not allocated on any nodes. */ - starting = 1, + starting, /** * The deployment is preparing to stop and deallocate the model from the relevant nodes. */ - stopping = 2 + stopping } export enum DeploymentAllocationState { /** * The trained model is started on at least one node. */ - started = 0, + started, /** * Trained model deployment is starting but it is not yet deployed on any nodes. */ - starting = 1, + starting, /** * Trained model deployment has started on all valid nodes. */ - fully_allocated = 3 + fully_allocated } export enum DeploymentAssignmentState { @@ -352,23 +352,23 @@ export enum RoutingState { /** * The allocation attempt failed. */ - failed = 0, + failed, /** * The trained model is allocated and ready to accept inference requests. */ - started = 1, + started, /** * The trained model is attempting to allocate on this node; inference requests are not yet accepted. */ - starting = 2, + starting, /** * The trained model is fully deallocated from this node. */ - stopped = 3, + stopped, /** * The trained model is being deallocated from this node. */ - stopping = 4 + stopping } export class TrainedModelAssignmentRoutingTable { diff --git a/specification/rollup/get_jobs/types.ts b/specification/rollup/get_jobs/types.ts index 50f4e59652..405ba2b34e 100644 --- a/specification/rollup/get_jobs/types.ts +++ b/specification/rollup/get_jobs/types.ts @@ -64,9 +64,9 @@ export class RollupJobStatus { } export enum IndexingJobState { - started = 0, - indexing = 1, - stopping = 2, - stopped = 3, - aborting = 4 + started, + indexing, + stopping, + stopped, + aborting } diff --git a/specification/searchable_snapshots/_types/stats.ts b/specification/searchable_snapshots/_types/stats.ts index e720fdfef6..db5e8ee90d 100644 --- a/specification/searchable_snapshots/_types/stats.ts +++ b/specification/searchable_snapshots/_types/stats.ts @@ -18,7 +18,7 @@ */ export enum StatsLevel { - cluster = 0, - indices = 1, - shards = 2 + cluster, + indices, + shards } diff --git a/specification/security/_types/RoleTemplate.ts b/specification/security/_types/RoleTemplate.ts index 2065b84377..3f4d384a38 100644 --- a/specification/security/_types/RoleTemplate.ts +++ b/specification/security/_types/RoleTemplate.ts @@ -20,8 +20,8 @@ import { Script } from '@_types/Scripting' export enum TemplateFormat { - string = 0, - json = 1 + string, + json } // ES: TemplateRoleName diff --git a/specification/security/get_token/types.ts b/specification/security/get_token/types.ts index 20bd5ef257..a1937f1f3e 100644 --- a/specification/security/get_token/types.ts +++ b/specification/security/get_token/types.ts @@ -21,10 +21,10 @@ import { User } from '@security/_types/User' import { Name } from '@_types/common' export enum AccessTokenGrantType { - password = 0, - client_credentials = 1, - _kerberos = 2, - refresh_token = 3 + password, + client_credentials, + _kerberos, + refresh_token } export class UserRealm { diff --git a/specification/security/grant_api_key/types.ts b/specification/security/grant_api_key/types.ts index 10377a4326..2957d81ecd 100644 --- a/specification/security/grant_api_key/types.ts +++ b/specification/security/grant_api_key/types.ts @@ -46,6 +46,6 @@ export class GrantApiKey { } export enum ApiKeyGrantType { - access_token = 0, - password = 1 + access_token, + password } diff --git a/specification/snapshot/_types/SnapshotShardsStatsStage.ts b/specification/snapshot/_types/SnapshotShardsStatsStage.ts index 6ce0c0f760..34b048fd71 100644 --- a/specification/snapshot/_types/SnapshotShardsStatsStage.ts +++ b/specification/snapshot/_types/SnapshotShardsStatsStage.ts @@ -19,13 +19,13 @@ export enum ShardsStatsStage { /** Number of shards in the snapshot that were successfully stored in the repository. */ - DONE = 0, + DONE, /** Number of shards in the snapshot that were not successfully stored in the repository. */ - FAILURE = 1, + FAILURE, /** Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. */ - FINALIZE = 2, + FINALIZE, /** Number of shards in the snapshot that are in the initializing stage of being stored in the repository. */ - INIT = 3, + INIT, /** Number of shards in the snapshot that are in the started stage of being stored in the repository. */ - STARTED = 4 + STARTED } diff --git a/specification/watcher/_types/Action.ts b/specification/watcher/_types/Action.ts index 8adfa9ef3b..4b8357cf86 100644 --- a/specification/watcher/_types/Action.ts +++ b/specification/watcher/_types/Action.ts @@ -62,12 +62,12 @@ export class Action { export type Actions = Dictionary export enum ActionType { - email = 0, - webhook = 1, - index = 2, - logging = 3, - slack = 4, - pagerduty = 5 + email, + webhook, + index, + logging, + slack, + pagerduty } export enum ActionExecutionMode { @@ -100,16 +100,16 @@ export class SimulatedActions { } export enum ActionStatusOptions { - success = 0, - failure = 1, - simulated = 2, - throttled = 3 + success, + failure, + simulated, + throttled } export enum AcknowledgementOptions { - awaits_successful_execution = 0, - ackable = 1, - acked = 2 + awaits_successful_execution, + ackable, + acked } export class AcknowledgeState { diff --git a/specification/watcher/_types/Conditions.ts b/specification/watcher/_types/Conditions.ts index 410bc9ce6d..5985ae080a 100644 --- a/specification/watcher/_types/Conditions.ts +++ b/specification/watcher/_types/Conditions.ts @@ -59,18 +59,18 @@ export class ConditionContainer { } export enum ConditionType { - always = 0, - never = 1, - script = 2, - compare = 3, - array_compare = 4 + always, + never, + script, + compare, + array_compare } export class NeverCondition {} export enum Quantifier { - some = 0, - all = 1 + some, + all } export class ScriptCondition { diff --git a/specification/watcher/_types/Execution.ts b/specification/watcher/_types/Execution.ts index 41ca764e82..83b1a47458 100644 --- a/specification/watcher/_types/Execution.ts +++ b/specification/watcher/_types/Execution.ts @@ -36,25 +36,25 @@ import { ConditionType } from './Conditions' import { InputType } from './Input' export enum ExecutionStatus { - awaits_execution = 0, - checking = 1, - execution_not_needed = 2, - throttled = 3, - executed = 4, - failed = 5, - deleted_while_queued = 6, - not_executed_already_queued = 7 + awaits_execution, + checking, + execution_not_needed, + throttled, + executed, + failed, + deleted_while_queued, + not_executed_already_queued } export enum ExecutionPhase { - awaits_execution = 0, - started = 1, - input = 2, - condition = 3, - actions = 4, - watch_transform = 5, - aborted = 6, - finished = 7 + awaits_execution, + started, + input, + condition, + actions, + watch_transform, + aborted, + finished } export class ExecutionResult { diff --git a/specification/watcher/_types/Input.ts b/specification/watcher/_types/Input.ts index 8b45a02187..7504ab6c9e 100644 --- a/specification/watcher/_types/Input.ts +++ b/specification/watcher/_types/Input.ts @@ -37,8 +37,8 @@ export class ChainInput { } export enum ConnectionScheme { - http = 0, - https = 1 + http, + https } export class HttpInput { @@ -57,11 +57,11 @@ export class HttpInputBasicAuthentication { } export enum HttpInputMethod { - head = 0, - get = 1, - post = 2, - put = 3, - delete = 4 + head, + get, + post, + put, + delete } export class HttpInputProxy { @@ -98,15 +98,15 @@ export class InputContainer { } export enum InputType { - http = 0, - search = 1, - simple = 2 + http, + search, + simple } export enum ResponseContentType { - json = 0, - yaml = 1, - text = 2 + json, + yaml, + text } export class SearchInput { diff --git a/specification/watcher/_types/Schedule.ts b/specification/watcher/_types/Schedule.ts index fa7cdf0fce..a5b3b1d6ce 100644 --- a/specification/watcher/_types/Schedule.ts +++ b/specification/watcher/_types/Schedule.ts @@ -35,13 +35,13 @@ export class DailySchedule { } export enum Day { - sunday = 0, - monday = 1, - tuesday = 2, - wednesday = 3, - thursday = 4, - friday = 5, - saturday = 6 + sunday, + monday, + tuesday, + wednesday, + thursday, + friday, + saturday } export class HourlySchedule { @@ -55,31 +55,26 @@ export class Interval { } export enum IntervalUnit { - /** @codegen_name second */ - s = 0, - /** @codegen_name minute */ - m = 1, - /** @codegen_name hour */ - h = 2, - /** @codegen_name day */ - d = 3, - /** @codegen_name week */ - w = 4 + second = 's', + minute = 'm', + hour = 'h', + day = 'd', + week = 'w' } export enum Month { - january = 0, - february = 1, - march = 2, - april = 3, - may = 4, - june = 5, - july = 6, - august = 7, - september = 8, - october = 9, - november = 10, - december = 11 + january, + february, + march, + april, + may, + june, + july, + august, + september, + october, + november, + december } /** diff --git a/specification/watcher/stats/types.ts b/specification/watcher/stats/types.ts index 9586717b3c..64ee510015 100644 --- a/specification/watcher/stats/types.ts +++ b/specification/watcher/stats/types.ts @@ -24,10 +24,10 @@ import { DateTime } from '@_types/Time' // Identical to DatafeedState, but kept separate as they're different enums in ES export enum WatcherState { - stopped = 0, - starting = 1, - started = 2, - stopping = 3 + stopped, + starting, + started, + stopping } export class WatcherNodeStats { @@ -41,10 +41,10 @@ export class WatcherNodeStats { export enum WatcherMetric { /** @aliases all */ - '_all' = 0, - 'queued_watches' = 1, - 'current_watches' = 2, - 'pending_watches' = 3 + '_all', + 'queued_watches', + 'current_watches', + 'pending_watches' } export class WatchRecordQueuedStats {