Skip to content

Commit 9d7e742

Browse files
committed
[API] Adds experimental Indices Sample Configuration APIs
1 parent 32054c6 commit 9d7e742

File tree

8 files changed

+454
-0
lines changed

8 files changed

+454
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Delete sampling configuration.
26+
# Delete the sampling configuration for the specified index.
27+
# This functionality is Experimental and may be changed or removed
28+
# completely in a future release. Elastic will take a best effort approach
29+
# to fix any issues, but experimental features are not subject to the
30+
# support SLA of official GA features.
31+
#
32+
# @option arguments [String] :index The name of the index. (*Required*)
33+
# @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is
34+
# received before the timeout expires, the request fails and returns an
35+
# error. Server default: 30s.
36+
# @option arguments [Time] :timeout Period to wait for a response.
37+
# If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
38+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
39+
# when they occur.
40+
# @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response
41+
# returned by Elasticsearch.
42+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
43+
# For example `"exists_time": "1h"` for humans and
44+
# `"exists_time_in_millis": 3600000` for computers. When disabled the human
45+
# readable values will be omitted. This makes sense for responses being consumed
46+
# only by machines.
47+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
48+
# this option for debugging only.
49+
# @option arguments [Hash] :headers Custom HTTP headers
50+
#
51+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling
52+
#
53+
def delete_sample_configuration(arguments = {})
54+
request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_sample_configuration' }
55+
56+
defined_params = [:index].each_with_object({}) do |variable, set_variables|
57+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
58+
end
59+
request_opts[:defined_params] = defined_params unless defined_params.empty?
60+
61+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
62+
63+
arguments = arguments.clone
64+
headers = arguments.delete(:headers) || {}
65+
66+
body = nil
67+
68+
_index = arguments.delete(:index)
69+
70+
method = Elasticsearch::API::HTTP_DELETE
71+
path = "#{Utils.listify(_index)}/_sample/config"
72+
params = Utils.process_params(arguments)
73+
74+
Elasticsearch::API::Response.new(
75+
perform_request(method, path, params, body, headers, request_opts)
76+
)
77+
end
78+
end
79+
end
80+
end
81+
end
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Get all sampling configurations.
26+
# Get the sampling configurations for all indices.
27+
# This functionality is Experimental and may be changed or removed
28+
# completely in a future release. Elastic will take a best effort approach
29+
# to fix any issues, but experimental features are not subject to the
30+
# support SLA of official GA features.
31+
#
32+
# @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is
33+
# received before the timeout expires, the request fails and returns an
34+
# error. Server default: 30s.
35+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
36+
# when they occur.
37+
# @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response
38+
# returned by Elasticsearch.
39+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
40+
# For example `"exists_time": "1h"` for humans and
41+
# `"exists_time_in_millis": 3600000` for computers. When disabled the human
42+
# readable values will be omitted. This makes sense for responses being consumed
43+
# only by machines.
44+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
45+
# this option for debugging only.
46+
# @option arguments [Hash] :headers Custom HTTP headers
47+
#
48+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling
49+
#
50+
def get_all_sample_configuration(arguments = {})
51+
request_opts = { endpoint: arguments[:endpoint] || 'indices.get_all_sample_configuration' }
52+
53+
arguments = arguments.clone
54+
headers = arguments.delete(:headers) || {}
55+
56+
body = nil
57+
58+
method = Elasticsearch::API::HTTP_GET
59+
path = '_sample/config'
60+
params = Utils.process_params(arguments)
61+
62+
Elasticsearch::API::Response.new(
63+
perform_request(method, path, params, body, headers, request_opts)
64+
)
65+
end
66+
end
67+
end
68+
end
69+
end
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Get sampling configuration.
26+
# Get the sampling configuration for the specified index.
27+
# This functionality is Experimental and may be changed or removed
28+
# completely in a future release. Elastic will take a best effort approach
29+
# to fix any issues, but experimental features are not subject to the
30+
# support SLA of official GA features.
31+
#
32+
# @option arguments [String] :index The name of the index. (*Required*)
33+
# @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is
34+
# received before the timeout expires, the request fails and returns an
35+
# error. Server default: 30s.
36+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
37+
# when they occur.
38+
# @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response
39+
# returned by Elasticsearch.
40+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
41+
# For example `"exists_time": "1h"` for humans and
42+
# `"exists_time_in_millis": 3600000` for computers. When disabled the human
43+
# readable values will be omitted. This makes sense for responses being consumed
44+
# only by machines.
45+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
46+
# this option for debugging only.
47+
# @option arguments [Hash] :headers Custom HTTP headers
48+
#
49+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling
50+
#
51+
def get_sample_configuration(arguments = {})
52+
request_opts = { endpoint: arguments[:endpoint] || 'indices.get_sample_configuration' }
53+
54+
defined_params = [:index].each_with_object({}) do |variable, set_variables|
55+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
56+
end
57+
request_opts[:defined_params] = defined_params unless defined_params.empty?
58+
59+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
60+
61+
arguments = arguments.clone
62+
headers = arguments.delete(:headers) || {}
63+
64+
body = nil
65+
66+
_index = arguments.delete(:index)
67+
68+
method = Elasticsearch::API::HTTP_GET
69+
path = "#{Utils.listify(_index)}/_sample/config"
70+
params = Utils.process_params(arguments)
71+
72+
Elasticsearch::API::Response.new(
73+
perform_request(method, path, params, body, headers, request_opts)
74+
)
75+
end
76+
end
77+
end
78+
end
79+
end
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Create or update sampling configuration.
26+
# Create or update the sampling configuration for the specified index.
27+
# This functionality is Experimental and may be changed or removed
28+
# completely in a future release. Elastic will take a best effort approach
29+
# to fix any issues, but experimental features are not subject to the
30+
# support SLA of official GA features.
31+
#
32+
# @option arguments [String] :index The name of the index or data stream. (*Required*)
33+
# @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is
34+
# received before the timeout expires, the request fails and returns an
35+
# error. Server default: 30s.
36+
# @option arguments [Time] :timeout Period to wait for a response.
37+
# If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
38+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
39+
# when they occur.
40+
# @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response
41+
# returned by Elasticsearch.
42+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
43+
# For example `"exists_time": "1h"` for humans and
44+
# `"exists_time_in_millis": 3600000` for computers. When disabled the human
45+
# readable values will be omitted. This makes sense for responses being consumed
46+
# only by machines.
47+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
48+
# this option for debugging only.
49+
# @option arguments [Hash] :headers Custom HTTP headers
50+
# @option arguments [Hash] :body request body
51+
#
52+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/group/ingest-random-sampling
53+
#
54+
def put_sample_configuration(arguments = {})
55+
request_opts = { endpoint: arguments[:endpoint] || 'indices.put_sample_configuration' }
56+
57+
defined_params = [:index].each_with_object({}) do |variable, set_variables|
58+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
59+
end
60+
request_opts[:defined_params] = defined_params unless defined_params.empty?
61+
62+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
63+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
64+
65+
arguments = arguments.clone
66+
headers = arguments.delete(:headers) || {}
67+
68+
body = arguments.delete(:body)
69+
70+
_index = arguments.delete(:index)
71+
72+
method = Elasticsearch::API::HTTP_PUT
73+
path = "#{Utils.listify(_index)}/_sample/config"
74+
params = Utils.process_params(arguments)
75+
76+
Elasticsearch::API::Response.new(
77+
perform_request(method, path, params, body, headers, request_opts)
78+
)
79+
end
80+
end
81+
end
82+
end
83+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
require 'spec_helper'
19+
20+
describe 'client.indices.delete_sample_configuration' do
21+
let(:expected_args) do
22+
[
23+
'DELETE',
24+
'foo/_sample/config',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.delete_sample_configuration', defined_params: { index: 'foo' } }
29+
]
30+
end
31+
32+
let(:index) { 'foo' }
33+
34+
it 'performs the request' do
35+
expect(client_double.indices.delete_sample_configuration(index: 'foo')).to be_a Elasticsearch::API::Response
36+
end
37+
end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
require 'spec_helper'
19+
20+
describe 'client.indices.get_all_sample_configuration' do
21+
let(:expected_args) do
22+
[
23+
'GET',
24+
'_sample/config',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.get_all_sample_configuration' }
29+
]
30+
end
31+
32+
it 'performs the request' do
33+
expect(client_double.indices.get_all_sample_configuration).to be_a Elasticsearch::API::Response
34+
end
35+
end

0 commit comments

Comments
 (0)