diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index a67139cc1..f51ee59dd 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -41040,6 +41040,9 @@ "reverse_nested": { "$ref": "#/components/schemas/_types.aggregations:ReverseNestedAggregation" }, + "random_sampler": { + "$ref": "#/components/schemas/_types.aggregations:RandomSamplerAggregation" + }, "sampler": { "$ref": "#/components/schemas/_types.aggregations:SamplerAggregation" }, @@ -47528,6 +47531,34 @@ } ] }, + "_types.aggregations:RandomSamplerAggregation": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.aggregations:BucketAggregationBase" + }, + { + "type": "object", + "properties": { + "probability": { + "description": "The probability that a document will be included in the aggregated data.\nMust be greater than 0, less than 0.5, or exactly 1.\nThe lower the probability, the fewer documents are matched.", + "type": "number" + }, + "seed": { + "description": "The seed to generate the random sampling of documents.\nWhen a seed is provided, the random subset of documents is the same between calls.", + "type": "number" + }, + "shard_seed": { + "description": "When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same.", + "x-available-since": "8.14.0", + "type": "number" + } + }, + "required": [ + "probability" + ] + } + ] + }, "_types.aggregations:SamplerAggregation": { "allOf": [ { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index b957cf4f5..139124d6b 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -46850,7 +46850,7 @@ } } ], - "specLocation": "_types/aggregations/AggregationContainer.ts#L106-L523", + "specLocation": "_types/aggregations/AggregationContainer.ts#L107-L533", "variants": { "kind": "container", "nonExhaustive": true @@ -52060,7 +52060,7 @@ "name": "Missing", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L525-L525", + "specLocation": "_types/aggregations/AggregationContainer.ts#L535-L535", "type": { "items": [ { @@ -59288,7 +59288,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1062-L1126" + "specLocation": "_types/aggregations/bucket.ts#L1081-L1145" }, { "codegenNames": [ @@ -59300,7 +59300,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1128-L1131", + "specLocation": "_types/aggregations/bucket.ts#L1147-L1150", "type": { "items": [ { @@ -59368,7 +59368,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1133-L1137" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1156" }, { "inherits": { @@ -59659,7 +59659,7 @@ "name": "MissingOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L526-L530" + "specLocation": "_types/aggregations/AggregationContainer.ts#L536-L540" }, { "kind": "enum", @@ -60242,7 +60242,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1000-L1002", + "specLocation": "_types/aggregations/bucket.ts#L1019-L1021", "type": { "items": [ { @@ -60717,7 +60717,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1184-L1208" + "specLocation": "_types/aggregations/bucket.ts#L1203-L1227" }, { "kind": "interface", @@ -60762,7 +60762,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1189-L1201" }, { "codegenNames": [ @@ -60774,7 +60774,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1025-L1026", + "specLocation": "_types/aggregations/bucket.ts#L1044-L1045", "type": { "items": [ { @@ -60809,7 +60809,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1022-L1023", + "specLocation": "_types/aggregations/bucket.ts#L1041-L1042", "type": { "items": [ { @@ -60872,7 +60872,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1028-L1037" + "specLocation": "_types/aggregations/bucket.ts#L1047-L1056" }, { "inherits": { @@ -61998,7 +61998,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1139-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1158-L1187" }, { "inherits": { @@ -63069,7 +63069,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1013" + "specLocation": "_types/aggregations/bucket.ts#L1023-L1032" }, { "kind": "interface", @@ -63724,6 +63724,46 @@ ], "specLocation": "_types/aggregations/bucket.ts#L726-L732" }, + { + "inherits": { + "type": { + "name": "BucketAggregationBase", + "namespace": "_types.aggregations" + } + }, + "kind": "interface", + "name": { + "name": "RandomSamplerAggregation", + "namespace": "_types.aggregations" + }, + "properties": [ + { + "description": "The probability that a document will be included in the aggregated data.\nMust be greater than 0, less than 0.5, or exactly 1.\nThe lower the probability, the fewer documents are matched.", + "name": "probability", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "The seed to generate the random sampling of documents.\nWhen a seed is provided, the random subset of documents is the same between calls.", + "name": "seed", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "_types/aggregations/bucket.ts#L734-L751" + }, { "inherits": { "type": { @@ -63751,7 +63791,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L734-L740" + "specLocation": "_types/aggregations/bucket.ts#L753-L759" }, { "inherits": { @@ -64059,7 +64099,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L777-L841" + "specLocation": "_types/aggregations/bucket.ts#L796-L860" }, { "kind": "interface", @@ -64093,7 +64133,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L742-L751" + "specLocation": "_types/aggregations/bucket.ts#L761-L770" }, { "kind": "enum", @@ -64115,7 +64155,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1015-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1034-L1039" }, { "kind": "interface", @@ -64137,7 +64177,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L753-L758" + "specLocation": "_types/aggregations/bucket.ts#L772-L777" }, { "kind": "interface", @@ -64171,7 +64211,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L760-L769" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "interface", @@ -64180,7 +64220,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L771-L771" + "specLocation": "_types/aggregations/bucket.ts#L790-L790" }, { "kind": "interface", @@ -64201,7 +64241,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L773-L775" + "specLocation": "_types/aggregations/bucket.ts#L792-L794" }, { "inherits": { @@ -64422,7 +64462,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L843-L915" + "specLocation": "_types/aggregations/bucket.ts#L862-L934" }, { "inherits": { @@ -64729,7 +64769,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L917-L982" + "specLocation": "_types/aggregations/bucket.ts#L936-L1001" }, { "inherits": { @@ -64770,7 +64810,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L984-L994" + "specLocation": "_types/aggregations/bucket.ts#L1003-L1013" }, { "inherits": { @@ -65394,7 +65434,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1039-L1060" + "specLocation": "_types/aggregations/bucket.ts#L1058-L1079" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index b3ec23548..bbf6f7717 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -51069,7 +51069,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1000-L1002", + "specLocation": "_types/aggregations/bucket.ts#L1019-L1021", "type": { "kind": "union_of", "items": [ @@ -52012,6 +52012,26 @@ } } }, + { + "availability": { + "stack": { + "since": "8.1.0", + "stability": "experimental" + } + }, + "description": "A single bucket aggregation that randomly includes documents in the aggregated results.\nSampling provides significant speed improvement at the cost of accuracy.", + "docId": "search-aggregations-random-sampler-aggregation", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-random-sampler-aggregation.html", + "name": "random_sampler", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RandomSamplerAggregation", + "namespace": "_types.aggregations" + } + } + }, { "description": "A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents.", "docId": "search-aggregations-bucket-sampler-aggregation", @@ -52273,7 +52293,7 @@ } } ], - "specLocation": "_types/aggregations/AggregationContainer.ts#L106-L523", + "specLocation": "_types/aggregations/AggregationContainer.ts#L107-L533", "variants": { "kind": "container", "nonExhaustive": true @@ -53618,7 +53638,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1062-L1126" + "specLocation": "_types/aggregations/bucket.ts#L1081-L1145" }, { "kind": "type_alias", @@ -53630,7 +53650,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1128-L1131", + "specLocation": "_types/aggregations/bucket.ts#L1147-L1150", "type": { "kind": "union_of", "items": [ @@ -53683,7 +53703,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L742-L751" + "specLocation": "_types/aggregations/bucket.ts#L761-L770" }, { "kind": "interface", @@ -54298,7 +54318,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1133-L1137" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1156" }, { "kind": "interface", @@ -55695,7 +55715,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1184-L1208" + "specLocation": "_types/aggregations/bucket.ts#L1203-L1227" }, { "kind": "interface", @@ -55795,7 +55815,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1189-L1201" }, { "kind": "enum", @@ -56666,7 +56686,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L753-L758" + "specLocation": "_types/aggregations/bucket.ts#L772-L777" }, { "kind": "interface", @@ -57555,7 +57575,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1139-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1158-L1187" }, { "kind": "interface", @@ -58482,7 +58502,7 @@ "name": "Missing", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L525-L525", + "specLocation": "_types/aggregations/AggregationContainer.ts#L535-L535", "type": { "kind": "union_of", "items": [ @@ -58592,7 +58612,7 @@ "name": "MissingOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L526-L530" + "specLocation": "_types/aggregations/AggregationContainer.ts#L536-L540" }, { "kind": "type_alias", @@ -59161,7 +59181,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L760-L769" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "interface", @@ -59327,7 +59347,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L771-L771" + "specLocation": "_types/aggregations/bucket.ts#L790-L790" }, { "kind": "interface", @@ -59628,6 +59648,63 @@ ], "specLocation": "_types/aggregations/pipeline.ts#L39-L51" }, + { + "kind": "interface", + "inherits": { + "type": { + "name": "BucketAggregationBase", + "namespace": "_types.aggregations" + } + }, + "name": { + "name": "RandomSamplerAggregation", + "namespace": "_types.aggregations" + }, + "properties": [ + { + "description": "The probability that a document will be included in the aggregated data.\nMust be greater than 0, less than 0.5, or exactly 1.\nThe lower the probability, the fewer documents are matched.", + "name": "probability", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "The seed to generate the random sampling of documents.\nWhen a seed is provided, the random subset of documents is the same between calls.", + "name": "seed", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "availability": { + "stack": { + "since": "8.14.0" + } + }, + "description": "When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same.", + "name": "shard_seed", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "_types/aggregations/bucket.ts#L734-L751" + }, { "kind": "interface", "inherits": { @@ -60109,7 +60186,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L734-L740" + "specLocation": "_types/aggregations/bucket.ts#L753-L759" }, { "kind": "enum", @@ -60152,7 +60229,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L773-L775" + "specLocation": "_types/aggregations/bucket.ts#L792-L794" }, { "kind": "interface", @@ -60658,7 +60735,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L777-L841" + "specLocation": "_types/aggregations/bucket.ts#L796-L860" }, { "kind": "interface", @@ -60920,7 +60997,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L843-L915" + "specLocation": "_types/aggregations/bucket.ts#L862-L934" }, { "kind": "interface", @@ -62330,7 +62407,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L917-L982" + "specLocation": "_types/aggregations/bucket.ts#L936-L1001" }, { "kind": "enum", @@ -62348,7 +62425,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1013" + "specLocation": "_types/aggregations/bucket.ts#L1023-L1032" }, { "kind": "enum", @@ -62370,7 +62447,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1015-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1034-L1039" }, { "kind": "interface", @@ -62412,7 +62489,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1025-L1026", + "specLocation": "_types/aggregations/bucket.ts#L1044-L1045", "type": { "kind": "union_of", "items": [ @@ -62447,7 +62524,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1022-L1023", + "specLocation": "_types/aggregations/bucket.ts#L1041-L1042", "type": { "kind": "union_of", "items": [ @@ -62510,7 +62587,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1028-L1037" + "specLocation": "_types/aggregations/bucket.ts#L1047-L1056" }, { "kind": "interface", @@ -62621,7 +62698,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L984-L994" + "specLocation": "_types/aggregations/bucket.ts#L1003-L1013" }, { "kind": "interface", @@ -63344,7 +63421,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1039-L1060" + "specLocation": "_types/aggregations/bucket.ts#L1058-L1079" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 3ca12f417..15a0e1364 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -3091,6 +3091,7 @@ export interface AggregationsAggregationContainer { rare_terms?: AggregationsRareTermsAggregation rate?: AggregationsRateAggregation reverse_nested?: AggregationsReverseNestedAggregation + random_sampler?: AggregationsRandomSamplerAggregation sampler?: AggregationsSamplerAggregation scripted_metric?: AggregationsScriptedMetricAggregation serial_diff?: AggregationsSerialDifferencingAggregation @@ -3979,6 +3980,12 @@ export interface AggregationsPipelineAggregationBase extends AggregationsBucketP gap_policy?: AggregationsGapPolicy } +export interface AggregationsRandomSamplerAggregation extends AggregationsBucketAggregationBase { + probability: double + seed?: integer + shard_seed?: integer +} + export interface AggregationsRangeAggregate extends AggregationsMultiBucketAggregateBase { } diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 8fcbc6072..286e15e03 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -486,6 +486,7 @@ search-aggregations-bucket-rare-terms-aggregation,https://www.elastic.co/guide/e search-aggregations-metrics-rate-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-metrics-rate-aggregation.html search-aggregations-bucket-reverse-nested-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-bucket-reverse-nested-aggregation.html search-aggregations-bucket-sampler-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-bucket-sampler-aggregation.html +search-aggregations-random-sampler-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-random-sampler-aggregation.html search-aggregations-metrics-scripted-metric-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-metrics-scripted-metric-aggregation.html search-aggregations-pipeline-serialdiff-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-pipeline-serialdiff-aggregation.html search-aggregations-bucket-significantterms-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-bucket-significantterms-aggregation.html diff --git a/specification/_types/aggregations/AggregationContainer.ts b/specification/_types/aggregations/AggregationContainer.ts index 84bec2d7a..ce5588510 100644 --- a/specification/_types/aggregations/AggregationContainer.ts +++ b/specification/_types/aggregations/AggregationContainer.ts @@ -44,6 +44,7 @@ import { MultiTermsAggregation, NestedAggregation, ParentAggregation, + RandomSamplerAggregation, RangeAggregation, RareTermsAggregation, ReverseNestedAggregation, @@ -427,6 +428,15 @@ export class AggregationContainer { * @doc_id search-aggregations-bucket-reverse-nested-aggregation */ reverse_nested?: ReverseNestedAggregation + /** + * + * A single bucket aggregation that randomly includes documents in the aggregated results. + * Sampling provides significant speed improvement at the cost of accuracy. + * @doc_id search-aggregations-random-sampler-aggregation + * @availability stack since=8.1.0 stability=experimental + + */ + random_sampler?: RandomSamplerAggregation /** * A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. * @doc_id search-aggregations-bucket-sampler-aggregation diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index d349ce7d2..e92aca4c4 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -731,6 +731,25 @@ export class ReverseNestedAggregation extends BucketAggregationBase { path?: Field } +export class RandomSamplerAggregation extends BucketAggregationBase { + /** + * The probability that a document will be included in the aggregated data. + * Must be greater than 0, less than 0.5, or exactly 1. + * The lower the probability, the fewer documents are matched. + */ + probability: double + /** + * The seed to generate the random sampling of documents. + * When a seed is provided, the random subset of documents is the same between calls. + */ + seed?: integer + /** + * When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same. + * @availability stack since=8.14.0 + */ + shard_seed?: integer +} + export class SamplerAggregation extends BucketAggregationBase { /** * Limits how many top-scoring documents are collected in the sample processed on each shard.