diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 7517dca013..b39529d1a6 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -43254,6 +43254,9 @@ "reverse_nested": { "$ref": "#/components/schemas/_types.aggregations:ReverseNestedAggregation" }, + "random_sampler": { + "$ref": "#/components/schemas/_types.aggregations:RandomSamplerAggregation" + }, "sampler": { "$ref": "#/components/schemas/_types.aggregations:SamplerAggregation" }, @@ -49742,6 +49745,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 487dbacf4d..1514152101 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -47034,7 +47034,7 @@ } } ], - "specLocation": "_types/aggregations/AggregationContainer.ts#L106-L523", + "specLocation": "_types/aggregations/AggregationContainer.ts#L107-L533", "variants": { "kind": "container", "nonExhaustive": true @@ -52244,7 +52244,7 @@ "name": "Missing", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L525-L525", + "specLocation": "_types/aggregations/AggregationContainer.ts#L535-L535", "type": { "items": [ { @@ -59472,7 +59472,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1062-L1126" + "specLocation": "_types/aggregations/bucket.ts#L1081-L1145" }, { "codegenNames": [ @@ -59484,7 +59484,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1128-L1131", + "specLocation": "_types/aggregations/bucket.ts#L1147-L1150", "type": { "items": [ { @@ -59552,7 +59552,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1133-L1137" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1156" }, { "inherits": { @@ -59843,7 +59843,7 @@ "name": "MissingOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L526-L530" + "specLocation": "_types/aggregations/AggregationContainer.ts#L536-L540" }, { "kind": "enum", @@ -60426,7 +60426,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1000-L1002", + "specLocation": "_types/aggregations/bucket.ts#L1019-L1021", "type": { "items": [ { @@ -60901,7 +60901,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1184-L1208" + "specLocation": "_types/aggregations/bucket.ts#L1203-L1227" }, { "kind": "interface", @@ -60946,7 +60946,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1189-L1201" }, { "codegenNames": [ @@ -60958,7 +60958,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1025-L1026", + "specLocation": "_types/aggregations/bucket.ts#L1044-L1045", "type": { "items": [ { @@ -60993,7 +60993,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1022-L1023", + "specLocation": "_types/aggregations/bucket.ts#L1041-L1042", "type": { "items": [ { @@ -61056,7 +61056,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1028-L1037" + "specLocation": "_types/aggregations/bucket.ts#L1047-L1056" }, { "inherits": { @@ -62182,7 +62182,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1139-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1158-L1187" }, { "inherits": { @@ -63253,7 +63253,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1013" + "specLocation": "_types/aggregations/bucket.ts#L1023-L1032" }, { "kind": "interface", @@ -63908,6 +63908,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": { @@ -63935,7 +63975,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L734-L740" + "specLocation": "_types/aggregations/bucket.ts#L753-L759" }, { "inherits": { @@ -64243,7 +64283,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L777-L841" + "specLocation": "_types/aggregations/bucket.ts#L796-L860" }, { "kind": "interface", @@ -64277,7 +64317,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L742-L751" + "specLocation": "_types/aggregations/bucket.ts#L761-L770" }, { "kind": "enum", @@ -64299,7 +64339,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1015-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1034-L1039" }, { "kind": "interface", @@ -64321,7 +64361,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L753-L758" + "specLocation": "_types/aggregations/bucket.ts#L772-L777" }, { "kind": "interface", @@ -64355,7 +64395,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L760-L769" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "interface", @@ -64364,7 +64404,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L771-L771" + "specLocation": "_types/aggregations/bucket.ts#L790-L790" }, { "kind": "interface", @@ -64385,7 +64425,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L773-L775" + "specLocation": "_types/aggregations/bucket.ts#L792-L794" }, { "inherits": { @@ -64606,7 +64646,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L843-L915" + "specLocation": "_types/aggregations/bucket.ts#L862-L934" }, { "inherits": { @@ -64913,7 +64953,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L917-L982" + "specLocation": "_types/aggregations/bucket.ts#L936-L1001" }, { "inherits": { @@ -64954,7 +64994,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L984-L994" + "specLocation": "_types/aggregations/bucket.ts#L1003-L1013" }, { "inherits": { @@ -65578,7 +65618,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 df35fb3090..effe405fb3 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 8e2a904102..f65d4e6f93 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 8fcbc6072a..286e15e033 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 84bec2d7aa..ce55885101 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 d349ce7d2b..e92aca4c43 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.