diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 252c7e8702..a7ad69f9d6 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -43120,6 +43120,9 @@ "reverse_nested": { "$ref": "#/components/schemas/_types.aggregations:ReverseNestedAggregation" }, + "random_sampler": { + "$ref": "#/components/schemas/_types.aggregations:RandomSamplerAggregation" + }, "sampler": { "$ref": "#/components/schemas/_types.aggregations:SamplerAggregation" }, @@ -50075,6 +50078,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 c597cac7aa..0d1e603c4e 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -47634,7 +47634,7 @@ } } ], - "specLocation": "_types/aggregations/AggregationContainer.ts#L106-L523", + "specLocation": "_types/aggregations/AggregationContainer.ts#L107-L533", "variants": { "kind": "container", "nonExhaustive": true @@ -53998,7 +53998,7 @@ "name": "Missing", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L525-L525", + "specLocation": "_types/aggregations/AggregationContainer.ts#L535-L535", "type": { "items": [ { @@ -61198,7 +61198,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1062-L1126" + "specLocation": "_types/aggregations/bucket.ts#L1081-L1145" }, { "codegenNames": [ @@ -61210,7 +61210,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1128-L1131", + "specLocation": "_types/aggregations/bucket.ts#L1147-L1150", "type": { "items": [ { @@ -61278,7 +61278,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1133-L1137" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1156" }, { "inherits": { @@ -61569,7 +61569,7 @@ "name": "MissingOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L526-L530" + "specLocation": "_types/aggregations/AggregationContainer.ts#L536-L540" }, { "kind": "enum", @@ -62152,7 +62152,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1000-L1002", + "specLocation": "_types/aggregations/bucket.ts#L1019-L1021", "type": { "items": [ { @@ -62627,7 +62627,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1184-L1208" + "specLocation": "_types/aggregations/bucket.ts#L1203-L1227" }, { "kind": "interface", @@ -62672,7 +62672,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1189-L1201" }, { "codegenNames": [ @@ -62684,7 +62684,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1025-L1026", + "specLocation": "_types/aggregations/bucket.ts#L1044-L1045", "type": { "items": [ { @@ -62719,7 +62719,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1022-L1023", + "specLocation": "_types/aggregations/bucket.ts#L1041-L1042", "type": { "items": [ { @@ -62782,7 +62782,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1028-L1037" + "specLocation": "_types/aggregations/bucket.ts#L1047-L1056" }, { "inherits": { @@ -63884,7 +63884,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1139-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1158-L1187" }, { "inherits": { @@ -64955,7 +64955,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1013" + "specLocation": "_types/aggregations/bucket.ts#L1023-L1032" }, { "kind": "interface", @@ -65610,6 +65610,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": { @@ -65637,7 +65677,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L734-L740" + "specLocation": "_types/aggregations/bucket.ts#L753-L759" }, { "inherits": { @@ -65945,7 +65985,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L777-L841" + "specLocation": "_types/aggregations/bucket.ts#L796-L860" }, { "kind": "interface", @@ -65979,7 +66019,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L742-L751" + "specLocation": "_types/aggregations/bucket.ts#L761-L770" }, { "kind": "enum", @@ -66001,7 +66041,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1015-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1034-L1039" }, { "kind": "interface", @@ -66023,7 +66063,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L753-L758" + "specLocation": "_types/aggregations/bucket.ts#L772-L777" }, { "kind": "interface", @@ -66057,7 +66097,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L760-L769" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "kind": "interface", @@ -66066,7 +66106,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L771-L771" + "specLocation": "_types/aggregations/bucket.ts#L790-L790" }, { "kind": "interface", @@ -66087,7 +66127,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L773-L775" + "specLocation": "_types/aggregations/bucket.ts#L792-L794" }, { "inherits": { @@ -66308,7 +66348,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L843-L915" + "specLocation": "_types/aggregations/bucket.ts#L862-L934" }, { "inherits": { @@ -66615,7 +66655,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L917-L982" + "specLocation": "_types/aggregations/bucket.ts#L936-L1001" }, { "inherits": { @@ -66656,7 +66696,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L984-L994" + "specLocation": "_types/aggregations/bucket.ts#L1003-L1013" }, { "inherits": { @@ -67280,7 +67320,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 e07fdc27e7..6bb6b97299 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -52516,7 +52516,7 @@ "name": "AggregateOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1000-L1002", + "specLocation": "_types/aggregations/bucket.ts#L1019-L1021", "type": { "items": [ { @@ -53462,6 +53462,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", @@ -53724,7 +53744,7 @@ } } ], - "specLocation": "_types/aggregations/AggregationContainer.ts#L106-L523", + "specLocation": "_types/aggregations/AggregationContainer.ts#L107-L533", "variants": { "kind": "container", "nonExhaustive": true @@ -55045,7 +55065,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1062-L1126" + "specLocation": "_types/aggregations/bucket.ts#L1081-L1145" }, { "codegenNames": [ @@ -55057,7 +55077,7 @@ "name": "CategorizeTextAnalyzer", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1128-L1131", + "specLocation": "_types/aggregations/bucket.ts#L1147-L1150", "type": { "items": [ { @@ -55110,7 +55130,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L742-L751" + "specLocation": "_types/aggregations/bucket.ts#L761-L770" }, { "attachedBehaviors": [ @@ -55725,7 +55745,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1133-L1137" + "specLocation": "_types/aggregations/bucket.ts#L1152-L1156" }, { "inherits": { @@ -57122,7 +57142,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1184-L1208" + "specLocation": "_types/aggregations/bucket.ts#L1203-L1227" }, { "attachedBehaviors": [ @@ -57222,7 +57242,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1170-L1182" + "specLocation": "_types/aggregations/bucket.ts#L1189-L1201" }, { "kind": "enum", @@ -58093,7 +58113,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L753-L758" + "specLocation": "_types/aggregations/bucket.ts#L772-L777" }, { "kind": "interface", @@ -58982,7 +59002,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1139-L1168" + "specLocation": "_types/aggregations/bucket.ts#L1158-L1187" }, { "attachedBehaviors": [ @@ -59909,7 +59929,7 @@ "name": "Missing", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L525-L525", + "specLocation": "_types/aggregations/AggregationContainer.ts#L535-L535", "type": { "items": [ { @@ -60019,7 +60039,7 @@ "name": "MissingOrder", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/AggregationContainer.ts#L526-L530" + "specLocation": "_types/aggregations/AggregationContainer.ts#L536-L540" }, { "kind": "type_alias", @@ -60588,7 +60608,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L760-L769" + "specLocation": "_types/aggregations/bucket.ts#L779-L788" }, { "attachedBehaviors": [ @@ -60754,7 +60774,7 @@ "namespace": "_types.aggregations" }, "properties": [], - "specLocation": "_types/aggregations/bucket.ts#L771-L771" + "specLocation": "_types/aggregations/bucket.ts#L790-L790" }, { "inherits": { @@ -61056,6 +61076,63 @@ "specLocation": "_types/aggregations/pipeline.ts#L39-L51" }, { + "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": { "generics": [ { @@ -61536,7 +61613,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L734-L740" + "specLocation": "_types/aggregations/bucket.ts#L753-L759" }, { "kind": "enum", @@ -61579,7 +61656,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L773-L775" + "specLocation": "_types/aggregations/bucket.ts#L792-L794" }, { "inherits": { @@ -62085,7 +62162,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L777-L841" + "specLocation": "_types/aggregations/bucket.ts#L796-L860" }, { "attachedBehaviors": [ @@ -62347,7 +62424,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L843-L915" + "specLocation": "_types/aggregations/bucket.ts#L862-L934" }, { "inherits": { @@ -63757,7 +63834,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L917-L982" + "specLocation": "_types/aggregations/bucket.ts#L936-L1001" }, { "kind": "enum", @@ -63775,7 +63852,7 @@ "name": "TermsAggregationCollectMode", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1004-L1013" + "specLocation": "_types/aggregations/bucket.ts#L1023-L1032" }, { "kind": "enum", @@ -63797,7 +63874,7 @@ "name": "TermsAggregationExecutionHint", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1015-L1020" + "specLocation": "_types/aggregations/bucket.ts#L1034-L1039" }, { "attachedBehaviors": [ @@ -63839,7 +63916,7 @@ "name": "TermsExclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1025-L1026", + "specLocation": "_types/aggregations/bucket.ts#L1044-L1045", "type": { "items": [ { @@ -63874,7 +63951,7 @@ "name": "TermsInclude", "namespace": "_types.aggregations" }, - "specLocation": "_types/aggregations/bucket.ts#L1022-L1023", + "specLocation": "_types/aggregations/bucket.ts#L1041-L1042", "type": { "items": [ { @@ -63937,7 +64014,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1028-L1037" + "specLocation": "_types/aggregations/bucket.ts#L1047-L1056" }, { "kind": "interface", @@ -64048,7 +64125,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L984-L994" + "specLocation": "_types/aggregations/bucket.ts#L1003-L1013" }, { "attachedBehaviors": [ @@ -64771,7 +64848,7 @@ } } ], - "specLocation": "_types/aggregations/bucket.ts#L1039-L1060" + "specLocation": "_types/aggregations/bucket.ts#L1058-L1079" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 31dfa54ccb..030eaab8ca 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -3070,6 +3070,7 @@ export interface AggregationsAggregationContainer { rare_terms?: AggregationsRareTermsAggregation rate?: AggregationsRateAggregation reverse_nested?: AggregationsReverseNestedAggregation + random_sampler?: AggregationsRandomSamplerAggregation sampler?: AggregationsSamplerAggregation scripted_metric?: AggregationsScriptedMetricAggregation serial_diff?: AggregationsSerialDifferencingAggregation @@ -3958,6 +3959,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 29c8449143..0cc4b0aba6 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -485,6 +485,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 9345e641e3..1bd0262076 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.