Skip to content

Commit 19f9f0e

Browse files
authored
Add sampling config specifications (#5573)
* Add sampling config specifications # Conflicts: # output/schema/schema.json * Update sampleconfig naming * regenerate output * address pr comments
1 parent cca1aa9 commit 19f9f0e

20 files changed

+1223
-20
lines changed

output/schema/schema.json

Lines changed: 658 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { ByteSize } from '@_types/common'
21+
import { double, integer, long } from '@_types/Numeric'
22+
import { DateTime, Duration } from '@_types/Time'
23+
24+
/**
25+
* Sampling configuration as returned by the API.
26+
*/
27+
export class SamplingConfiguration {
28+
/**
29+
* The fraction of documents to sample between 0 and 1.
30+
*/
31+
rate: double
32+
/**
33+
* The maximum number of documents to sample.
34+
*/
35+
max_samples: integer
36+
/**
37+
* The maximum total size of sampled documents.
38+
*/
39+
max_size?: ByteSize
40+
/**
41+
* The maximum total size of sampled documents in bytes.
42+
*/
43+
max_size_in_bytes: long
44+
/**
45+
* The duration for which the sampled documents should be retained.
46+
*/
47+
time_to_live?: Duration
48+
/**
49+
* The duration for which the sampled documents should be retained, in milliseconds.
50+
*/
51+
time_to_live_in_millis: long
52+
/**
53+
* An optional condition script that sampled documents must satisfy.
54+
*/
55+
if?: string
56+
/**
57+
* The time when the sampling configuration was created.
58+
*/
59+
creation_time?: DateTime
60+
/**
61+
* The time when the sampling configuration was created, in milliseconds since epoch.
62+
*/
63+
creation_time_in_millis: long
64+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { IndexName } from '@_types/common'
22+
import { Duration } from '@_types/Time'
23+
24+
/**
25+
* Delete sampling configuration.
26+
* Delete the sampling configuration for the specified index.
27+
* @rest_spec_name indices.delete_sample_configuration
28+
* @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental
29+
* @doc_id random_sample
30+
* @doc_tag random_sample
31+
*/
32+
export interface Request extends RequestBase {
33+
urls: [
34+
{
35+
path: '/{index}/_sample/config'
36+
methods: ['DELETE']
37+
}
38+
]
39+
path_parts: {
40+
/**
41+
* The name of the index.
42+
*/
43+
index: IndexName
44+
}
45+
query_parameters: {
46+
/**
47+
* Period to wait for a connection to the master node. If no response is
48+
* received before the timeout expires, the request fails and returns an
49+
* error.
50+
* @server_default 30s
51+
*/
52+
master_timeout?: Duration
53+
/**
54+
* Period to wait for a response.
55+
* If no response is received before the timeout expires, the request fails and returns an error.
56+
* @server_default 30s
57+
*/
58+
timeout?: Duration
59+
}
60+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response {
23+
/** @codegen_name result */
24+
body: AcknowledgedResponseBase
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# summary: ''
2+
description: A successful response for deleting a sampling configuration.
3+
# type: response
4+
# response_code: 200
5+
value: |-
6+
{
7+
"acknowledged": true
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
method_request: DELETE /my-index/_sample/config
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Duration } from '@_types/Time'
22+
23+
/**
24+
* Get all sampling configurations.
25+
* Get the sampling configurations for all indices.
26+
* @rest_spec_name indices.get_all_sample_configuration
27+
* @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental
28+
* @doc_id random_sample
29+
* @doc_tag random_sample
30+
*/
31+
export interface Request extends RequestBase {
32+
urls: [
33+
{
34+
path: '/_sample/config'
35+
methods: ['GET']
36+
}
37+
]
38+
query_parameters: {
39+
/**
40+
* Period to wait for a connection to the master node. If no response is
41+
* received before the timeout expires, the request fails and returns an
42+
* error.
43+
* @server_default 30s
44+
*/
45+
master_timeout?: Duration
46+
}
47+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { IndexSamplingConfiguration } from './_types/IndexSamplingConfiguration'
21+
22+
export class Response {
23+
body: {
24+
configurations: IndexSamplingConfiguration[]
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { IndexName } from '@_types/common'
21+
import { SamplingConfiguration } from '@indices/_types/SampleConfiguration'
22+
23+
export class IndexSamplingConfiguration {
24+
index: IndexName
25+
configuration: SamplingConfiguration
26+
}

0 commit comments

Comments
 (0)