From 4c3578921c8c9464f70933a4d85642b44a36f722 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:44:17 +0200 Subject: [PATCH] Decay placement in additional properties (#2666) * decay placement in additional properties * ops --- output/openapi/elasticsearch-openapi.json | 12 +- .../elasticsearch-serverless-openapi.json | 12 +- output/schema/schema-serverless.json | 188 ++++++++++++------ output/schema/schema.json | 118 ++++++----- output/typescript/types.ts | 12 +- specification/_types/query_dsl/compound.ts | 18 +- 6 files changed, 211 insertions(+), 149 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index ff06b8ab3a..a93efdc06d 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -57844,14 +57844,14 @@ "_types.query_dsl:DateDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementDateMathDuration" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDateMathDuration" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementDateMathDuration": { + "_types.query_dsl:DecayFunctionBaseDateMathDuration": { "type": "object", "properties": { "multi_value_mode": { @@ -57862,14 +57862,14 @@ "_types.query_dsl:NumericDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementdoubledouble" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBasedoubledouble" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementdoubledouble": { + "_types.query_dsl:DecayFunctionBasedoubledouble": { "type": "object", "properties": { "multi_value_mode": { @@ -57880,14 +57880,14 @@ "_types.query_dsl:GeoDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementGeoLocationDistance" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseGeoLocationDistance" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementGeoLocationDistance": { + "_types.query_dsl:DecayFunctionBaseGeoLocationDistance": { "type": "object", "properties": { "multi_value_mode": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index dd54f997e5..5af9e80fe9 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -35165,14 +35165,14 @@ "_types.query_dsl:DateDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementDateMathDuration" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDateMathDuration" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementDateMathDuration": { + "_types.query_dsl:DecayFunctionBaseDateMathDuration": { "type": "object", "properties": { "multi_value_mode": { @@ -35183,14 +35183,14 @@ "_types.query_dsl:NumericDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementdoubledouble" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBasedoubledouble" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementdoubledouble": { + "_types.query_dsl:DecayFunctionBasedoubledouble": { "type": "object", "properties": { "multi_value_mode": { @@ -35201,14 +35201,14 @@ "_types.query_dsl:GeoDecayFunction": { "allOf": [ { - "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseDecayPlacementGeoLocationDistance" + "$ref": "#/components/schemas/_types.query_dsl:DecayFunctionBaseGeoLocationDistance" }, { "type": "object" } ] }, - "_types.query_dsl:DecayFunctionBaseDecayPlacementGeoLocationDistance": { + "_types.query_dsl:DecayFunctionBaseGeoLocationDistance": { "type": "object", "properties": { "multi_value_mode": { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 21590b326b..63e2cd6bd1 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -50074,6 +50074,9 @@ ], "inherits": { "generics": [ + { + "kind": "user_defined_value" + }, { "kind": "user_defined_value" } @@ -50089,7 +50092,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L188-L188" + "specLocation": "_types/query_dsl/compound.ts#L188-L191" }, { "attachedBehaviors": [ @@ -50106,10 +50109,26 @@ } }, { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayFunctionBase" + } + }, + { + "kind": "instance_of", + "type": { + "name": "TScale", + "namespace": "_types.query_dsl.DecayFunctionBase" + } + } + ], "kind": "instance_of", "type": { - "name": "TPlacement", - "namespace": "_types.query_dsl.DecayFunctionBase" + "name": "DecayPlacement", + "namespace": "_types.query_dsl" } } ], @@ -50125,7 +50144,11 @@ ], "generics": [ { - "name": "TPlacement", + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayFunctionBase" + }, + { + "name": "TScale", "namespace": "_types.query_dsl.DecayFunctionBase" } ], @@ -50171,6 +50194,76 @@ "properties": [], "specLocation": "_spec_utils/behaviors.ts#L39-L48" }, + { + "generics": [ + { + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayPlacement" + }, + { + "name": "TScale", + "namespace": "_types.query_dsl.DecayPlacement" + } + ], + "kind": "interface", + "name": { + "name": "DecayPlacement", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "description": "Defines how documents are scored at the distance given at scale.", + "name": "decay", + "required": false, + "serverDefault": 0.5, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "If defined, the decay function will only compute the decay function for documents with a distance greater than the defined `offset`.", + "name": "offset", + "required": false, + "serverDefault": "0", + "type": { + "kind": "instance_of", + "type": { + "name": "TScale", + "namespace": "_types.query_dsl.DecayPlacement" + } + } + }, + { + "description": "Defines the distance from origin + offset at which the computed score will equal `decay` parameter.", + "name": "scale", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TScale", + "namespace": "_types.query_dsl.DecayPlacement" + } + } + }, + { + "description": "The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields.", + "name": "origin", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayPlacement" + } + } + } + ], + "specLocation": "_types/query_dsl/compound.ts#L154-L173" + }, { "kind": "enum", "members": [ @@ -50204,26 +50297,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "DateMath", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "DateMath", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" } } ], @@ -50238,7 +50322,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L192-L194" + "specLocation": "_types/query_dsl/compound.ts#L193-L193" }, { "attachedBehaviors": [ @@ -50247,26 +50331,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "double", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" } } ], @@ -50281,7 +50356,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L189-L191" + "specLocation": "_types/query_dsl/compound.ts#L192-L192" }, { "attachedBehaviors": [ @@ -50290,26 +50365,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "Distance", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "GeoLocation", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "Distance", + "namespace": "_types" } } ], @@ -50324,7 +50390,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L195-L197" + "specLocation": "_types/query_dsl/compound.ts#L194-L197" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index a1c459571d..db4c6228f6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -75443,26 +75443,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "DateMath", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "DateMath", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" } } ], @@ -75477,7 +75468,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L192-L194" + "specLocation": "_types/query_dsl/compound.ts#L193-L193" }, { "inherits": { @@ -75628,10 +75619,26 @@ } }, { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayFunctionBase" + } + }, + { + "kind": "instance_of", + "type": { + "name": "TScale", + "namespace": "_types.query_dsl.DecayFunctionBase" + } + } + ], "kind": "instance_of", "type": { - "name": "TPlacement", - "namespace": "_types.query_dsl.DecayFunctionBase" + "name": "DecayPlacement", + "namespace": "_types.query_dsl" } } ], @@ -75647,7 +75654,11 @@ ], "generics": [ { - "name": "TPlacement", + "name": "TOrigin", + "namespace": "_types.query_dsl.DecayFunctionBase" + }, + { + "name": "TScale", "namespace": "_types.query_dsl.DecayFunctionBase" } ], @@ -76619,26 +76630,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "Distance", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "GeoLocation", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "Distance", + "namespace": "_types" } } ], @@ -76653,7 +76655,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L195-L197" + "specLocation": "_types/query_dsl/compound.ts#L194-L197" }, { "inherits": { @@ -79233,26 +79235,17 @@ "inherits": { "generics": [ { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - } - ], "kind": "instance_of", "type": { - "name": "DecayPlacement", - "namespace": "_types.query_dsl" + "name": "double", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" } } ], @@ -79267,7 +79260,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L189-L191" + "specLocation": "_types/query_dsl/compound.ts#L192-L192" }, { "kind": "enum", @@ -83294,6 +83287,9 @@ ], "inherits": { "generics": [ + { + "kind": "user_defined_value" + }, { "kind": "user_defined_value" } @@ -83309,7 +83305,7 @@ "namespace": "_types.query_dsl" }, "properties": [], - "specLocation": "_types/query_dsl/compound.ts#L188-L188" + "specLocation": "_types/query_dsl/compound.ts#L188-L191" }, { "inherits": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 6d11470683..4497dfab5e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5492,7 +5492,7 @@ export interface QueryDslConstantScoreQuery extends QueryDslQueryBase { filter: QueryDslQueryContainer } -export interface QueryDslDateDecayFunctionKeys extends QueryDslDecayFunctionBase> { +export interface QueryDslDateDecayFunctionKeys extends QueryDslDecayFunctionBase { } export type QueryDslDateDecayFunction = QueryDslDateDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -5507,7 +5507,7 @@ export interface QueryDslDateRangeQuery extends QueryDslRangeQueryBase export type QueryDslDecayFunction = QueryDslUntypedDecayFunction | QueryDslDateDecayFunction | QueryDslNumericDecayFunction | QueryDslGeoDecayFunction -export interface QueryDslDecayFunctionBase { +export interface QueryDslDecayFunctionBase { multi_value_mode?: QueryDslMultiValueMode } @@ -5598,7 +5598,7 @@ export interface QueryDslGeoBoundingBoxQueryKeys extends QueryDslQueryBase { export type QueryDslGeoBoundingBoxQuery = QueryDslGeoBoundingBoxQueryKeys & { [property: string]: GeoBounds | QueryDslGeoExecution | QueryDslGeoValidationMethod | boolean | float | string } -export interface QueryDslGeoDecayFunctionKeys extends QueryDslDecayFunctionBase> { +export interface QueryDslGeoDecayFunctionKeys extends QueryDslDecayFunctionBase { } export type QueryDslGeoDecayFunction = QueryDslGeoDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -5852,7 +5852,7 @@ export interface QueryDslNestedQuery extends QueryDslQueryBase { export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { } -export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase> { +export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase { } export type QueryDslNumericDecayFunction = QueryDslNumericDecayFunctionKeys & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } @@ -6219,10 +6219,10 @@ export interface QueryDslTypeQuery extends QueryDslQueryBase { value: string } -export interface QueryDslUntypedDecayFunctionKeys extends QueryDslDecayFunctionBase { +export interface QueryDslUntypedDecayFunctionKeys extends QueryDslDecayFunctionBase { } export type QueryDslUntypedDecayFunction = QueryDslUntypedDecayFunctionKeys - & { [property: string]: any } + & { [property: string]: QueryDslDecayPlacement | QueryDslMultiValueMode } export interface QueryDslUntypedDistanceFeatureQuery extends QueryDslDistanceFeatureQueryBase { } diff --git a/specification/_types/query_dsl/compound.ts b/specification/_types/query_dsl/compound.ts index f420e1b608..35b4ce0020 100644 --- a/specification/_types/query_dsl/compound.ts +++ b/specification/_types/query_dsl/compound.ts @@ -175,8 +175,8 @@ export class DecayPlacement { /** * @behavior_meta AdditionalProperty key=field value=placement */ -export class DecayFunctionBase - implements AdditionalProperty +export class DecayFunctionBase + implements AdditionalProperty> { /** * Determines how the distance is calculated when a field used for computing the decay contains multiple values. @@ -185,15 +185,15 @@ export class DecayFunctionBase multi_value_mode?: MultiValueMode } -export class UntypedDecayFunction extends DecayFunctionBase {} -export class NumericDecayFunction extends DecayFunctionBase< - DecayPlacement -> {} -export class DateDecayFunction extends DecayFunctionBase< - DecayPlacement +export class UntypedDecayFunction extends DecayFunctionBase< + UserDefinedValue, + UserDefinedValue > {} +export class NumericDecayFunction extends DecayFunctionBase {} +export class DateDecayFunction extends DecayFunctionBase {} export class GeoDecayFunction extends DecayFunctionBase< - DecayPlacement + GeoLocation, + Distance > {} /**