diff --git a/output/schema/schema.json b/output/schema/schema.json index 10d5e4bda2..55f6935a88 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -7292,18 +7292,29 @@ { "availability": { "stack": { - "featureFlag": "random_sampling" + "featureFlag": "random_sampling", + "since": "9.3.0", + "stability": "experimental", + "visibility": "feature_flag" } }, - "description": "Delete sampling configuration for an index or data stream", - "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-sample-configuration", + "description": "Delete sampling configuration.\nDelete the sampling configuration for the specified index.", + "docId": "random_sample", + "docTag": "random_sample", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling", "name": "indices.delete_sample_configuration", - "request": null, + "request": { + "name": "Request", + "namespace": "indices.delete_sample_configuration" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "indices.delete_sample_configuration" + }, "responseMediaType": [ "application/json" ], @@ -7879,15 +7890,26 @@ { "availability": { "stack": { - "featureFlag": "random_sampling" + "featureFlag": "random_sampling", + "since": "9.3.0", + "stability": "experimental", + "visibility": "feature_flag" } }, - "description": "Get sampling configurations for all indices and data streams", - "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-all-sample-configuration", + "description": "Get all sampling configurations.\nGet the sampling configurations for all indices.", + "docId": "random_sample", + "docTag": "random_sample", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling", "name": "indices.get_all_sample_configuration", - "request": null, + "request": { + "name": "Request", + "namespace": "indices.get_all_sample_configuration" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "indices.get_all_sample_configuration" + }, "responseMediaType": [ "application/json" ], @@ -8370,15 +8392,26 @@ { "availability": { "stack": { - "featureFlag": "random_sampling" + "featureFlag": "random_sampling", + "since": "9.3.0", + "stability": "experimental", + "visibility": "feature_flag" } }, - "description": "Get sampling configuration for an index or data stream", - "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-sample-configuration", + "description": "Get sampling configuration.\nGet the sampling configuration for the specified index.", + "docId": "random_sample", + "docTag": "random_sample", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling", "name": "indices.get_sample_configuration", - "request": null, + "request": { + "name": "Request", + "namespace": "indices.get_sample_configuration" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "indices.get_sample_configuration" + }, "responseMediaType": [ "application/json" ], @@ -9044,18 +9077,29 @@ { "availability": { "stack": { - "featureFlag": "random_sampling" + "featureFlag": "random_sampling", + "since": "9.3.0", + "stability": "experimental", + "visibility": "feature_flag" } }, - "description": "Configure sampling for an index or data stream", - "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-sample-configuration", + "description": "Create or update sampling configuration.\nCreate or update the sampling configuration for the specified index.", + "docId": "random_sample", + "docTag": "random_sample", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling", "name": "indices.put_sample_configuration", - "request": null, + "request": { + "name": "Request", + "namespace": "indices.put_sample_configuration" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "indices.put_sample_configuration" + }, "responseMediaType": [ "application/json" ], @@ -152519,6 +152563,125 @@ }, "specLocation": "indices/_types/Downsample.ts#L33-L36" }, + { + "kind": "interface", + "description": "Sampling configuration as returned by the API.", + "name": { + "name": "SamplingConfiguration", + "namespace": "indices._types" + }, + "properties": [ + { + "description": "The fraction of documents to sample between 0 and 1.", + "name": "rate", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, + { + "description": "The maximum number of documents to sample.", + "name": "max_samples", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The maximum total size of sampled documents.", + "name": "max_size", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + }, + { + "description": "The maximum total size of sampled documents in bytes.", + "name": "max_size_in_bytes", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "The duration for which the sampled documents should be retained.", + "name": "time_to_live", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The duration for which the sampled documents should be retained, in milliseconds.", + "name": "time_to_live_in_millis", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "An optional condition script that sampled documents must satisfy.", + "name": "if", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The time when the sampling configuration was created.", + "name": "creation_time", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DateTime", + "namespace": "_types" + } + } + }, + { + "description": "The time when the sampling configuration was created, in milliseconds since epoch.", + "name": "creation_time_in_millis", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/_types/SampleConfiguration.ts#L24-L64" + }, { "kind": "interface", "name": { @@ -157017,6 +157180,99 @@ }, "specLocation": "indices/delete_index_template/IndicesDeleteIndexTemplateResponse.ts#L22-L25" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Delete sampling configuration.\nDelete the sampling configuration for the specified index.", + "examples": { + "IndicesDeleteSampleConfigurationRequest1": { + "method_request": "DELETE /my-index/_sample/config" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.delete_sample_configuration" + }, + "path": [ + { + "description": "The name of the index.", + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "Period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/delete_sample_configuration/IndicesDeleteSampleConfigurationRequest.ts#L24-L60" + }, + { + "kind": "response", + "body": { + "kind": "value", + "codegenName": "result", + "value": { + "kind": "instance_of", + "type": { + "name": "AcknowledgedResponseBase", + "namespace": "_types" + } + } + }, + "examples": { + "IndicesDeleteSampleConfigurationResponse1": { + "description": "A successful response for deleting a sampling configuration.", + "value": "{\n \"acknowledged\": true\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.delete_sample_configuration" + }, + "specLocation": "indices/delete_sample_configuration/IndicesDeleteSampleConfigurationResponse.ts#L22-L25" + }, { "kind": "request", "attachedBehaviors": [ @@ -159567,6 +159823,113 @@ ], "specLocation": "indices/get_alias/_types/response.ts#L28-L36" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get all sampling configurations.\nGet the sampling configurations for all indices.", + "examples": { + "IndicesGetAllSampleConfigurationRequest1": { + "method_request": "GET /_sample/config" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.get_all_sample_configuration" + }, + "path": [], + "query": [ + { + "description": "Period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationRequest.ts#L23-L47" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "configurations", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndexSamplingConfiguration", + "namespace": "indices.get_all_sample_configuration._types" + } + } + } + } + ] + }, + "examples": { + "IndicesGetAllSampleConfigurationResponse1": { + "description": "A successful response for retrieving all sampling configurations.", + "value": "{\n \"configurations\": [\n {\n \"index\": \"my-index\",\n \"configuration\": {\n \"rate\": 0.05,\n \"max_samples\": 1000,\n \"max_size_in_bytes\": 10485760,\n \"time_to_live_in_millis\": 86400000,\n \"if\": \"ctx?.network?.name == 'Guest'\",\n \"creation_time_in_millis\": 1761677431066\n }\n }\n ]\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.get_all_sample_configuration" + }, + "specLocation": "indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationResponse.ts#L22-L26" + }, + { + "kind": "interface", + "name": { + "name": "IndexSamplingConfiguration", + "namespace": "indices.get_all_sample_configuration._types" + }, + "properties": [ + { + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "name": "configuration", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SamplingConfiguration", + "namespace": "indices._types" + } + } + } + ], + "specLocation": "indices/get_all_sample_configuration/_types/IndexSamplingConfiguration.ts#L23-L26" + }, { "kind": "interface", "name": { @@ -161562,6 +161925,114 @@ ], "specLocation": "indices/get_sample/_types/RawDocument.ts#L24-L33" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get sampling configuration.\nGet the sampling configuration for the specified index.", + "examples": { + "IndicesGetSampleConfigurationRequest1": { + "method_request": "GET /my-index/_sample/config" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.get_sample_configuration" + }, + "path": [ + { + "description": "The name of the index.", + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "Period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/get_sample_configuration/IndicesGetSampleConfigurationRequest.ts#L24-L54" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "name": "configuration", + "required": true, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "SamplingConfiguration", + "namespace": "indices._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "_builtins" + } + } + ] + } + } + ] + }, + "examples": { + "IndicesGetSampleConfigurationResponse1": { + "description": "A successful response for retrieving the sampling configuration for an index.", + "value": "{\n \"index\": \"my-index\",\n \"configuration\": {\n \"rate\": 0.05,\n \"max_samples\": 1000,\n \"max_size_in_bytes\": 10485760,\n \"time_to_live_in_millis\": 86400000,\n \"if\": \"ctx?.network?.name == 'Guest'\",\n \"creation_time_in_millis\": 1761341004982\n }\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.get_sample_configuration" + }, + "specLocation": "indices/get_sample_configuration/IndicesGetSampleConfigurationResponse.ts#L23-L28" + }, { "kind": "request", "attachedBehaviors": [ @@ -164705,6 +165176,173 @@ }, "specLocation": "indices/put_mapping/IndicesPutMappingResponse.ts#L22-L25" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The fraction of documents to sample. Must be greater than 0 and less than or equal to 1.\nCan be specified as a number or a string.", + "name": "rate", + "required": true, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + ], + "type": { + "name": "Stringified", + "namespace": "_spec_utils" + } + } + }, + { + "description": "The maximum number of documents to sample. Must be greater than 0 and less than or equal to 10,000.", + "name": "max_samples", + "required": false, + "serverDefault": 100, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The maximum total size of sampled documents. Must be greater than 0 and less than or equal to 5GB.", + "name": "max_size", + "required": false, + "serverDefault": "1GB", + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + }, + { + "description": "The duration for which the sampled documents should be retained.\nMust be greater than 0 and less than or equal to 30 days.", + "name": "time_to_live", + "required": false, + "serverDefault": "10d", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "An optional condition script that sampled documents must satisfy.", + "name": "if", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "description": "Create or update sampling configuration.\nCreate or update the sampling configuration for the specified index.", + "examples": { + "IndicesPutSampleConfigurationRequest1": { + "method_request": "PUT /my-index/_sample/config\n{\n \"rate\": 0.05,\n \"max_samples\": 1000,\n \"max_size\": \"10mb\",\n \"time_to_live\": \"1d\",\n \"if\": \"ctx?.network?.name == 'Guest'\"\n}" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.put_sample_configuration" + }, + "path": [ + { + "description": "The name of the index or data stream.", + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "Period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/put_sample_configuration/IndicesPutSampleConfigurationRequest.ts#L26-L89" + }, + { + "kind": "response", + "body": { + "kind": "value", + "codegenName": "result", + "value": { + "kind": "instance_of", + "type": { + "name": "AcknowledgedResponseBase", + "namespace": "_types" + } + } + }, + "examples": { + "IndicesPutSampleConfigurationResponse1": { + "description": "A successful response for creating or updating a sampling configuration.", + "value": "{\n \"acknowledged\": true\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.put_sample_configuration" + }, + "specLocation": "indices/put_sample_configuration/IndicesPutSampleConfigurationResponse.ts#L22-L25" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 2bf1edf279..10fac8a9d4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12227,6 +12227,17 @@ export interface IndicesRetentionLease { period: Duration } +export interface IndicesSamplingConfiguration { + rate: double + max_samples: integer + max_size?: ByteSize + max_size_in_bytes: long + time_to_live?: Duration + time_to_live_in_millis: long + if?: string + creation_time?: DateTime + creation_time_in_millis: long +} export type IndicesSamplingMethod = 'aggregate' | 'last_value' export interface IndicesSearchIdle { @@ -12636,6 +12647,14 @@ export interface IndicesDeleteIndexTemplateRequest extends RequestBase { export type IndicesDeleteIndexTemplateResponse = AcknowledgedResponseBase +export interface IndicesDeleteSampleConfigurationRequest extends RequestBase { + index: IndexName + master_timeout?: Duration + timeout?: Duration +} + +export type IndicesDeleteSampleConfigurationResponse = AcknowledgedResponseBase + export interface IndicesDeleteTemplateRequest extends RequestBase { name: Name master_timeout?: Duration @@ -12847,6 +12866,19 @@ export interface IndicesGetAliasNotFoundAliasesKeys { export type IndicesGetAliasNotFoundAliases = IndicesGetAliasNotFoundAliasesKeys & { [property: string]: IndicesGetAliasIndexAliases | string | number } +export interface IndicesGetAllSampleConfigurationRequest extends RequestBase { + master_timeout?: Duration +} + +export interface IndicesGetAllSampleConfigurationResponse { + configurations: IndicesGetAllSampleConfigurationIndexSamplingConfiguration[] +} + +export interface IndicesGetAllSampleConfigurationIndexSamplingConfiguration { + index: IndexName + configuration: IndicesSamplingConfiguration +} + export interface IndicesGetDataLifecycleDataStreamWithLifecycle { name: DataStreamName lifecycle?: IndicesDataStreamLifecycleWithRollover @@ -13025,6 +13057,16 @@ export interface IndicesGetSampleRawDocument { source: Record } +export interface IndicesGetSampleConfigurationRequest extends RequestBase { + index: IndexName + master_timeout?: Duration +} + +export interface IndicesGetSampleConfigurationResponse { + index: IndexName + configuration: IndicesSamplingConfiguration | null +} + export interface IndicesGetSampleStatsRequest extends RequestBase { index: IndexName } @@ -13281,6 +13323,21 @@ export interface IndicesPutMappingRequest extends RequestBase { export type IndicesPutMappingResponse = IndicesResponseBase +export interface IndicesPutSampleConfigurationRequest extends RequestBase { + index: IndexName + master_timeout?: Duration + timeout?: Duration + body?: { + rate: SpecUtilsStringified + max_samples?: integer + max_size?: ByteSize + time_to_live?: Duration + if?: string + } +} + +export type IndicesPutSampleConfigurationResponse = AcknowledgedResponseBase + export interface IndicesPutSettingsRequest extends RequestBase { index?: Indices allow_no_indices?: boolean diff --git a/specification/indices/_types/SampleConfiguration.ts b/specification/indices/_types/SampleConfiguration.ts new file mode 100644 index 0000000000..0c2ef1632c --- /dev/null +++ b/specification/indices/_types/SampleConfiguration.ts @@ -0,0 +1,64 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ByteSize } from '@_types/common' +import { double, integer, long } from '@_types/Numeric' +import { DateTime, Duration } from '@_types/Time' + +/** + * Sampling configuration as returned by the API. + */ +export class SamplingConfiguration { + /** + * The fraction of documents to sample between 0 and 1. + */ + rate: double + /** + * The maximum number of documents to sample. + */ + max_samples: integer + /** + * The maximum total size of sampled documents. + */ + max_size?: ByteSize + /** + * The maximum total size of sampled documents in bytes. + */ + max_size_in_bytes: long + /** + * The duration for which the sampled documents should be retained. + */ + time_to_live?: Duration + /** + * The duration for which the sampled documents should be retained, in milliseconds. + */ + time_to_live_in_millis: long + /** + * An optional condition script that sampled documents must satisfy. + */ + if?: string + /** + * The time when the sampling configuration was created. + */ + creation_time?: DateTime + /** + * The time when the sampling configuration was created, in milliseconds since epoch. + */ + creation_time_in_millis: long +} diff --git a/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationRequest.ts b/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationRequest.ts new file mode 100644 index 0000000000..f3c0b733db --- /dev/null +++ b/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationRequest.ts @@ -0,0 +1,60 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { IndexName } from '@_types/common' +import { Duration } from '@_types/Time' + +/** + * Delete sampling configuration. + * Delete the sampling configuration for the specified index. + * @rest_spec_name indices.delete_sample_configuration + * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental + * @doc_id random_sample + * @doc_tag random_sample + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/{index}/_sample/config' + methods: ['DELETE'] + } + ] + path_parts: { + /** + * The name of the index. + */ + index: IndexName + } + query_parameters: { + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + /** + * Period to wait for a response. + * If no response is received before the timeout expires, the request fails and returns an error. + * @server_default 30s + */ + timeout?: Duration + } +} diff --git a/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationResponse.ts b/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationResponse.ts new file mode 100644 index 0000000000..9e7bdb91cd --- /dev/null +++ b/specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationResponse.ts @@ -0,0 +1,25 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AcknowledgedResponseBase } from '@_types/Base' + +export class Response { + /** @codegen_name result */ + body: AcknowledgedResponseBase +} diff --git a/specification/indices/delete_sample_configuration/examples/200_response/IndicesDeleteSampleConfigurationResponse1.yaml b/specification/indices/delete_sample_configuration/examples/200_response/IndicesDeleteSampleConfigurationResponse1.yaml new file mode 100644 index 0000000000..2b95fe3d51 --- /dev/null +++ b/specification/indices/delete_sample_configuration/examples/200_response/IndicesDeleteSampleConfigurationResponse1.yaml @@ -0,0 +1,8 @@ +# summary: '' +description: A successful response for deleting a sampling configuration. +# type: response +# response_code: 200 +value: |- + { + "acknowledged": true + } diff --git a/specification/indices/delete_sample_configuration/examples/request/IndicesDeleteSampleConfigurationRequest1.yaml b/specification/indices/delete_sample_configuration/examples/request/IndicesDeleteSampleConfigurationRequest1.yaml new file mode 100644 index 0000000000..5a46bab146 --- /dev/null +++ b/specification/indices/delete_sample_configuration/examples/request/IndicesDeleteSampleConfigurationRequest1.yaml @@ -0,0 +1 @@ +method_request: DELETE /my-index/_sample/config diff --git a/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationRequest.ts b/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationRequest.ts new file mode 100644 index 0000000000..67fb38bb1b --- /dev/null +++ b/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationRequest.ts @@ -0,0 +1,47 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Duration } from '@_types/Time' + +/** + * Get all sampling configurations. + * Get the sampling configurations for all indices. + * @rest_spec_name indices.get_all_sample_configuration + * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental + * @doc_id random_sample + * @doc_tag random_sample + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_sample/config' + methods: ['GET'] + } + ] + query_parameters: { + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + } +} diff --git a/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationResponse.ts b/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationResponse.ts new file mode 100644 index 0000000000..c1784da36f --- /dev/null +++ b/specification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationResponse.ts @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IndexSamplingConfiguration } from './_types/IndexSamplingConfiguration' + +export class Response { + body: { + configurations: IndexSamplingConfiguration[] + } +} diff --git a/specification/indices/get_all_sample_configuration/_types/IndexSamplingConfiguration.ts b/specification/indices/get_all_sample_configuration/_types/IndexSamplingConfiguration.ts new file mode 100644 index 0000000000..5c51177a70 --- /dev/null +++ b/specification/indices/get_all_sample_configuration/_types/IndexSamplingConfiguration.ts @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IndexName } from '@_types/common' +import { SamplingConfiguration } from '@indices/_types/SampleConfiguration' + +export class IndexSamplingConfiguration { + index: IndexName + configuration: SamplingConfiguration +} diff --git a/specification/indices/get_all_sample_configuration/examples/200_response/IndicesGetAllSampleConfigurationResponse1.yaml b/specification/indices/get_all_sample_configuration/examples/200_response/IndicesGetAllSampleConfigurationResponse1.yaml new file mode 100644 index 0000000000..b3696a3d16 --- /dev/null +++ b/specification/indices/get_all_sample_configuration/examples/200_response/IndicesGetAllSampleConfigurationResponse1.yaml @@ -0,0 +1,20 @@ +# summary: '' +description: A successful response for retrieving all sampling configurations. +# type: response +# response_code: 200 +value: |- + { + "configurations": [ + { + "index": "my-index", + "configuration": { + "rate": 0.05, + "max_samples": 1000, + "max_size_in_bytes": 10485760, + "time_to_live_in_millis": 86400000, + "if": "ctx?.network?.name == 'Guest'", + "creation_time_in_millis": 1761677431066 + } + } + ] + } diff --git a/specification/indices/get_all_sample_configuration/examples/request/IndicesGetAllSampleConfigurationRequest1.yaml b/specification/indices/get_all_sample_configuration/examples/request/IndicesGetAllSampleConfigurationRequest1.yaml new file mode 100644 index 0000000000..92d682710b --- /dev/null +++ b/specification/indices/get_all_sample_configuration/examples/request/IndicesGetAllSampleConfigurationRequest1.yaml @@ -0,0 +1 @@ +method_request: GET /_sample/config diff --git a/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationRequest.ts b/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationRequest.ts new file mode 100644 index 0000000000..aaceacebc7 --- /dev/null +++ b/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationRequest.ts @@ -0,0 +1,54 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { IndexName } from '@_types/common' +import { Duration } from '@_types/Time' + +/** + * Get sampling configuration. + * Get the sampling configuration for the specified index. + * @rest_spec_name indices.get_sample_configuration + * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental + * @doc_id random_sample + * @doc_tag random_sample + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/{index}/_sample/config' + methods: ['GET'] + } + ] + path_parts: { + /** + * The name of the index. + */ + index: IndexName + } + query_parameters: { + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + } +} diff --git a/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationResponse.ts b/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationResponse.ts new file mode 100644 index 0000000000..6fe564e72a --- /dev/null +++ b/specification/indices/get_sample_configuration/IndicesGetSampleConfigurationResponse.ts @@ -0,0 +1,28 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IndexName } from '@_types/common' +import { SamplingConfiguration } from '@indices/_types/SampleConfiguration' + +export class Response { + body: { + index: IndexName + configuration: SamplingConfiguration | null + } +} diff --git a/specification/indices/get_sample_configuration/examples/200_response/IndicesGetSampleConfigurationResponse1.yaml b/specification/indices/get_sample_configuration/examples/200_response/IndicesGetSampleConfigurationResponse1.yaml new file mode 100644 index 0000000000..bccf1b45d3 --- /dev/null +++ b/specification/indices/get_sample_configuration/examples/200_response/IndicesGetSampleConfigurationResponse1.yaml @@ -0,0 +1,16 @@ +# summary: '' +description: A successful response for retrieving the sampling configuration for an index. +# type: response +# response_code: 200 +value: |- + { + "index": "my-index", + "configuration": { + "rate": 0.05, + "max_samples": 1000, + "max_size_in_bytes": 10485760, + "time_to_live_in_millis": 86400000, + "if": "ctx?.network?.name == 'Guest'", + "creation_time_in_millis": 1761341004982 + } + } diff --git a/specification/indices/get_sample_configuration/examples/request/IndicesGetSampleConfigurationRequest1.yaml b/specification/indices/get_sample_configuration/examples/request/IndicesGetSampleConfigurationRequest1.yaml new file mode 100644 index 0000000000..b87965b251 --- /dev/null +++ b/specification/indices/get_sample_configuration/examples/request/IndicesGetSampleConfigurationRequest1.yaml @@ -0,0 +1 @@ +method_request: GET /my-index/_sample/config diff --git a/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationRequest.ts b/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationRequest.ts new file mode 100644 index 0000000000..6a612ba1cf --- /dev/null +++ b/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationRequest.ts @@ -0,0 +1,89 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { ByteSize, IndexName } from '@_types/common' +import { double, integer } from '@_types/Numeric' +import { Duration } from '@_types/Time' +import { Stringified } from '@spec_utils/Stringified' + +/** + * Create or update sampling configuration. + * Create or update the sampling configuration for the specified index. + * @rest_spec_name indices.put_sample_configuration + * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental + * @doc_id random_sample + * @doc_tag random_sample + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/{index}/_sample/config' + methods: ['PUT'] + } + ] + path_parts: { + /** + * The name of the index or data stream. + */ + index: IndexName + } + query_parameters: { + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + /** + * Period to wait for a response. + * If no response is received before the timeout expires, the request fails and returns an error. + * @server_default 30s + */ + timeout?: Duration + } + body: { + /** + * The fraction of documents to sample. Must be greater than 0 and less than or equal to 1. + * Can be specified as a number or a string. + */ + rate: Stringified + /** + * The maximum number of documents to sample. Must be greater than 0 and less than or equal to 10,000. + * @server_default 100 + */ + max_samples?: integer + /** + * The maximum total size of sampled documents. Must be greater than 0 and less than or equal to 5GB. + * @server_default 1GB + */ + max_size?: ByteSize + /** + * The duration for which the sampled documents should be retained. + * Must be greater than 0 and less than or equal to 30 days. + * @server_default 10d + */ + time_to_live?: Duration + /** + * An optional condition script that sampled documents must satisfy. + */ + if?: string + } +} diff --git a/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationResponse.ts b/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationResponse.ts new file mode 100644 index 0000000000..9e7bdb91cd --- /dev/null +++ b/specification/indices/put_sample_configuration/IndicesPutSampleConfigurationResponse.ts @@ -0,0 +1,25 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AcknowledgedResponseBase } from '@_types/Base' + +export class Response { + /** @codegen_name result */ + body: AcknowledgedResponseBase +} diff --git a/specification/indices/put_sample_configuration/examples/200_response/IndicesPutSampleConfigurationResponse1.yaml b/specification/indices/put_sample_configuration/examples/200_response/IndicesPutSampleConfigurationResponse1.yaml new file mode 100644 index 0000000000..a9f60b90a6 --- /dev/null +++ b/specification/indices/put_sample_configuration/examples/200_response/IndicesPutSampleConfigurationResponse1.yaml @@ -0,0 +1,8 @@ +# summary: '' +description: A successful response for creating or updating a sampling configuration. +# type: response +# response_code: 200 +value: |- + { + "acknowledged": true + } diff --git a/specification/indices/put_sample_configuration/examples/request/IndicesPutSampleConfigurationRequest1.yaml b/specification/indices/put_sample_configuration/examples/request/IndicesPutSampleConfigurationRequest1.yaml new file mode 100644 index 0000000000..f3710c2524 --- /dev/null +++ b/specification/indices/put_sample_configuration/examples/request/IndicesPutSampleConfigurationRequest1.yaml @@ -0,0 +1,9 @@ +method_request: |- + PUT /my-index/_sample/config + { + "rate": 0.05, + "max_samples": 1000, + "max_size": "10mb", + "time_to_live": "1d", + "if": "ctx?.network?.name == 'Guest'" + }