Skip to content

Commit 167bcea

Browse files
committed
[API] Adds features.reset_features endpoint
1 parent cc12511 commit 167bcea

File tree

4 files changed

+88
-7
lines changed

4 files changed

+88
-7
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/features/get_features.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ module Elasticsearch
1919
module API
2020
module Features
2121
module Actions
22-
# Returns a list of features which can be snapshotted in this cluster.
22+
# Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot
2323
#
2424
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
2525
# @option arguments [Hash] :headers Custom HTTP headers
2626
#
27-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html
27+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-features-api.html
2828
#
2929
def get_features(arguments = {})
3030
headers = arguments.delete(:headers) || {}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
module Elasticsearch
19+
module API
20+
module Features
21+
module Actions
22+
# Resets the internal state of features, usually by deleting system indices
23+
# This functionality is Experimental and may be changed or removed
24+
# completely in a future release. Elastic will take a best effort approach
25+
# to fix any issues, but experimental features are not subject to the
26+
# support SLA of official GA features.
27+
#
28+
# @option arguments [Hash] :headers Custom HTTP headers
29+
#
30+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html
31+
#
32+
def reset_features(arguments = {})
33+
headers = arguments.delete(:headers) || {}
34+
35+
arguments = arguments.clone
36+
37+
method = Elasticsearch::API::HTTP_POST
38+
path = "_features/_reset"
39+
params = {}
40+
41+
body = nil
42+
perform_request(method, path, params, body, headers).body
43+
end
44+
end
45+
end
46+
end
47+
end

elasticsearch-api/spec/elasticsearch/api/actions/features/get_features_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
describe 'client.featues#get_features' do
2121
let(:expected_args) do
2222
[
23-
'GET',
24-
'_features',
25-
{},
26-
nil,
27-
{}
23+
'GET',
24+
'_features',
25+
{},
26+
nil,
27+
{}
2828
]
2929
end
3030

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.featues#reset_features' do
21+
let(:expected_args) do
22+
[
23+
'POST',
24+
'_features/_reset',
25+
{},
26+
nil,
27+
{}
28+
]
29+
end
30+
31+
it 'performs the request' do
32+
expect(client_double.features.reset_features).to eq({})
33+
end
34+
end

0 commit comments

Comments
 (0)