opensearch-api 1.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile +2 -2
- data/README.md +12 -182
- data/Rakefile +5 -5
- data/USER_GUIDE.md +155 -0
- data/lib/opensearch/api/actions/benchmark.rb +0 -1
- data/lib/opensearch/api/actions/bulk.rb +1 -7
- data/lib/opensearch/api/actions/cat/all_pit_segments.rb +46 -0
- data/lib/opensearch/api/actions/cat/allocation.rb +4 -2
- data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
- data/lib/opensearch/api/actions/cat/indices.rb +4 -2
- data/lib/opensearch/api/actions/cat/master.rb +3 -1
- data/lib/opensearch/api/actions/cat/nodeattrs.rb +4 -2
- data/lib/opensearch/api/actions/cat/nodes.rb +4 -2
- data/lib/opensearch/api/actions/cat/pending_tasks.rb +4 -2
- data/lib/opensearch/api/actions/cat/pit_segments.rb +49 -0
- data/lib/opensearch/api/actions/cat/plugins.rb +4 -2
- data/lib/opensearch/api/actions/cat/repositories.rb +4 -2
- data/lib/opensearch/api/actions/cat/shards.rb +4 -2
- data/lib/opensearch/api/actions/cat/snapshots.rb +3 -1
- data/lib/opensearch/api/actions/cat/templates.rb +4 -2
- data/lib/opensearch/api/actions/cat/thread_pool.rb +4 -2
- data/lib/opensearch/api/actions/cluster/delete_component_template.rb +4 -2
- data/lib/opensearch/api/actions/cluster/exists_component_template.rb +4 -2
- data/lib/opensearch/api/actions/cluster/get_component_template.rb +4 -2
- data/lib/opensearch/api/actions/cluster/get_settings.rb +3 -1
- data/lib/opensearch/api/actions/cluster/health.rb +4 -2
- data/lib/opensearch/api/actions/cluster/pending_tasks.rb +5 -3
- data/lib/opensearch/api/actions/cluster/put_component_template.rb +4 -2
- data/lib/opensearch/api/actions/cluster/put_settings.rb +3 -1
- data/lib/opensearch/api/actions/cluster/reroute.rb +4 -2
- data/lib/opensearch/api/actions/cluster/state.rb +4 -2
- data/lib/opensearch/api/actions/count.rb +1 -6
- data/lib/opensearch/api/actions/create.rb +0 -1
- data/lib/opensearch/api/actions/create_pit.rb +45 -0
- data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +4 -2
- data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +4 -2
- data/lib/opensearch/api/actions/delete.rb +1 -8
- data/lib/opensearch/api/actions/delete_all_pits.rb +26 -0
- data/lib/opensearch/api/actions/delete_by_query.rb +1 -8
- data/lib/opensearch/api/actions/delete_pit.rb +30 -0
- data/lib/opensearch/api/actions/delete_script.rb +4 -2
- data/lib/opensearch/api/actions/exists.rb +1 -8
- data/lib/opensearch/api/actions/exists_source.rb +1 -8
- data/lib/opensearch/api/actions/explain.rb +1 -8
- data/lib/opensearch/api/actions/features/get_features.rb +4 -2
- data/lib/opensearch/api/actions/get.rb +1 -8
- data/lib/opensearch/api/actions/get_all_pits.rb +26 -0
- data/lib/opensearch/api/actions/get_script.rb +4 -2
- data/lib/opensearch/api/actions/get_source.rb +1 -8
- data/lib/opensearch/api/actions/index.rb +1 -8
- data/lib/opensearch/api/actions/indices/add_block.rb +3 -1
- data/lib/opensearch/api/actions/indices/clone.rb +3 -1
- data/lib/opensearch/api/actions/indices/close.rb +3 -1
- data/lib/opensearch/api/actions/indices/create.rb +4 -4
- data/lib/opensearch/api/actions/indices/delete.rb +3 -1
- data/lib/opensearch/api/actions/indices/delete_alias.rb +4 -2
- data/lib/opensearch/api/actions/indices/delete_index_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/delete_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/exists_index_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/exists_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/get.rb +4 -4
- data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
- data/lib/opensearch/api/actions/indices/get_index_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/get_mapping.rb +5 -12
- data/lib/opensearch/api/actions/indices/get_settings.rb +3 -1
- data/lib/opensearch/api/actions/indices/get_template.rb +4 -4
- data/lib/opensearch/api/actions/indices/open.rb +3 -1
- data/lib/opensearch/api/actions/indices/put_alias.rb +4 -2
- data/lib/opensearch/api/actions/indices/put_index_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/put_mapping.rb +4 -13
- data/lib/opensearch/api/actions/indices/put_settings.rb +3 -1
- data/lib/opensearch/api/actions/indices/put_template.rb +4 -4
- data/lib/opensearch/api/actions/indices/rollover.rb +3 -3
- data/lib/opensearch/api/actions/indices/shrink.rb +3 -1
- data/lib/opensearch/api/actions/indices/simulate_index_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/simulate_template.rb +4 -2
- data/lib/opensearch/api/actions/indices/split.rb +3 -1
- data/lib/opensearch/api/actions/indices/update_aliases.rb +4 -2
- data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
- data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +3 -1
- data/lib/opensearch/api/actions/ingest/get_pipeline.rb +4 -2
- data/lib/opensearch/api/actions/ingest/put_pipeline.rb +3 -1
- data/lib/opensearch/api/actions/mget.rb +2 -7
- data/lib/opensearch/api/actions/msearch.rb +1 -6
- data/lib/opensearch/api/actions/msearch_template.rb +1 -6
- data/lib/opensearch/api/actions/mtermvectors.rb +1 -6
- data/lib/opensearch/api/actions/put_script.rb +3 -1
- data/lib/opensearch/api/actions/search.rb +1 -7
- data/lib/opensearch/api/actions/search_shards.rb +1 -1
- data/lib/opensearch/api/actions/search_template.rb +1 -6
- data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/clone.rb +4 -2
- data/lib/opensearch/api/actions/snapshot/create.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/create_repository.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/delete.rb +4 -2
- data/lib/opensearch/api/actions/snapshot/delete_repository.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/get.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/get_features.rb +4 -2
- data/lib/opensearch/api/actions/snapshot/get_repository.rb +3 -2
- data/lib/opensearch/api/actions/snapshot/restore.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/status.rb +3 -1
- data/lib/opensearch/api/actions/snapshot/verify_repository.rb +3 -1
- data/lib/opensearch/api/actions/termvectors.rb +1 -8
- data/lib/opensearch/api/actions/update.rb +1 -8
- data/lib/opensearch/api/actions/update_by_query.rb +1 -8
- data/lib/opensearch/api/utils.rb +5 -5
- data/lib/opensearch/api/version.rb +1 -1
- data/lib/opensearch/api.rb +1 -1
- data/opensearch-api.gemspec +2 -3
- data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
- data/spec/opensearch/api/actions/cat/all_pit_segments_spec.rb +36 -0
- data/spec/opensearch/api/actions/cat/allocation_spec.rb +6 -7
- data/spec/opensearch/api/actions/cat/cluster_manager_spec.rb +26 -0
- data/spec/opensearch/api/actions/cat/pit_segments_spec.rb +43 -0
- data/spec/opensearch/api/actions/count_spec.rb +3 -3
- data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
- data/spec/opensearch/api/actions/create_pit_spec.rb +58 -0
- data/spec/opensearch/api/actions/delete_all_pits_spec.rb +35 -0
- data/spec/opensearch/api/actions/delete_by_query_spec.rb +0 -17
- data/spec/opensearch/api/actions/delete_document_spec.rb +10 -10
- data/spec/opensearch/api/actions/delete_pit_spec.rb +41 -0
- data/spec/opensearch/api/actions/exists_document_spec.rb +10 -10
- data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
- data/spec/opensearch/api/actions/get_all_pits_spec.rb +35 -0
- data/spec/opensearch/api/actions/get_document_source_spec.rb +6 -6
- data/spec/opensearch/api/actions/get_document_spec.rb +8 -8
- data/spec/opensearch/api/actions/get_script_spec.rb +2 -2
- data/spec/opensearch/api/actions/hashie_spec.rb +0 -2
- data/spec/opensearch/api/actions/index_document_spec.rb +12 -12
- data/spec/opensearch/api/actions/indices/clone_spec.rb +2 -2
- data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +0 -11
- data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +5 -16
- data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +8 -21
- data/spec/opensearch/api/actions/indices/validate_query_spec.rb +0 -10
- data/spec/opensearch/api/actions/mget_spec.rb +2 -17
- data/spec/opensearch/api/actions/mtermvectors_spec.rb +3 -3
- data/spec/opensearch/api/actions/search_spec.rb +5 -16
- data/spec/opensearch/api/actions/termvectors_spec.rb +5 -5
- data/spec/opensearch/api/actions/update_document_spec.rb +11 -11
- data/spec/opensearch/api/utils_spec.rb +7 -14
- data.tar.gz.sig +0 -0
- metadata +40 -43
- metadata.gz.sig +0 -0
- data/lib/opensearch/api/actions/close_point_in_time.rb +0 -50
- data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
- data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
- data/lib/opensearch/api/actions/open_point_in_time.rb +0 -72
- data/spec/opensearch/api/actions/close_point_in_time_spec.rb +0 -43
- data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
- data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
- data/spec/opensearch/api/actions/open_point_in_time_spec.rb +0 -53
@@ -1,117 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
#
|
3
|
-
# The OpenSearch Contributors require contributions made to
|
4
|
-
# this file be licensed under the Apache-2.0 license or a
|
5
|
-
# compatible open source license.
|
6
|
-
#
|
7
|
-
# Modifications Copyright OpenSearch Contributors. See
|
8
|
-
# GitHub history for details.
|
9
|
-
#
|
10
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
-
# license agreements. See the NOTICE file distributed with
|
12
|
-
# this work for additional information regarding copyright
|
13
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
-
# not use this file except in compliance with the License.
|
16
|
-
# You may obtain a copy of the License at
|
17
|
-
#
|
18
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
-
#
|
20
|
-
# Unless required by applicable law or agreed to in writing,
|
21
|
-
# software distributed under the License is distributed on an
|
22
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
-
# KIND, either express or implied. See the License for the
|
24
|
-
# specific language governing permissions and limitations
|
25
|
-
# under the License.
|
26
|
-
|
27
|
-
require 'spec_helper'
|
28
|
-
|
29
|
-
describe 'client.indices#exists_type' do
|
30
|
-
|
31
|
-
let(:expected_args) do
|
32
|
-
[
|
33
|
-
'HEAD',
|
34
|
-
url,
|
35
|
-
params,
|
36
|
-
nil,
|
37
|
-
{}
|
38
|
-
]
|
39
|
-
end
|
40
|
-
|
41
|
-
let(:params) do
|
42
|
-
{}
|
43
|
-
end
|
44
|
-
|
45
|
-
let(:url) do
|
46
|
-
'foo/_mapping/bar'
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'performs the request' do
|
50
|
-
expect(client_double.indices.exists_type(index: 'foo', type: 'bar')).to eq(true)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'aliased to a predicate method' do
|
54
|
-
expect(client_double.indices.exists_type?(index: 'foo', type: 'bar')).to eq(true)
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'when multiple indices are specified' do
|
58
|
-
|
59
|
-
let(:url) do
|
60
|
-
'foo,bar/_mapping/bam'
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'performs the request' do
|
64
|
-
expect(client_double.indices.exists_type(index: ['foo','bar'], type: 'bam')).to eq(true)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when the path needs to be URL-escaped' do
|
69
|
-
|
70
|
-
let(:url) do
|
71
|
-
'foo%5Ebar/_mapping/bar%2Fbam'
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'performs the request' do
|
75
|
-
expect(client_double.indices.exists_type(index: 'foo^bar', type: 'bar/bam')).to eq(true)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context 'when 404 response is received' do
|
80
|
-
|
81
|
-
let(:response_double) do
|
82
|
-
double('response', status: 404, body: {}, headers: {})
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'returns false' do
|
86
|
-
expect(client_double.indices.exists_type(index: 'foo', type: 'bar')).to eq(false)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'when a \'not found\' exception is raised' do
|
91
|
-
|
92
|
-
let(:client) do
|
93
|
-
Class.new { include OpenSearch::API }.new.tap do |_client|
|
94
|
-
expect(_client).to receive(:perform_request).with(*expected_args).and_raise(StandardError.new('404 Not Found'))
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'returns false' do
|
99
|
-
expect(client.indices.exists_type(index: 'foo', type: 'bar')).to eq(false)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when a generic exception is raised' do
|
104
|
-
|
105
|
-
let(:client) do
|
106
|
-
Class.new { include OpenSearch::API }.new.tap do |_client|
|
107
|
-
expect(_client).to receive(:perform_request).with(*expected_args).and_raise(StandardError.new)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'raises the exception' do
|
112
|
-
expect {
|
113
|
-
client.indices.exists_type(index: 'foo', type: 'bar')
|
114
|
-
}.to raise_exception(StandardError)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
#
|
3
|
-
# The OpenSearch Contributors require contributions made to
|
4
|
-
# this file be licensed under the Apache-2.0 license or a
|
5
|
-
# compatible open source license.
|
6
|
-
#
|
7
|
-
# Modifications Copyright OpenSearch Contributors. See
|
8
|
-
# GitHub history for details.
|
9
|
-
#
|
10
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
-
# license agreements. See the NOTICE file distributed with
|
12
|
-
# this work for additional information regarding copyright
|
13
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
-
# not use this file except in compliance with the License.
|
16
|
-
# You may obtain a copy of the License at
|
17
|
-
#
|
18
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
-
#
|
20
|
-
# Unless required by applicable law or agreed to in writing,
|
21
|
-
# software distributed under the License is distributed on an
|
22
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
-
# KIND, either express or implied. See the License for the
|
24
|
-
# specific language governing permissions and limitations
|
25
|
-
# under the License.
|
26
|
-
|
27
|
-
require 'spec_helper'
|
28
|
-
|
29
|
-
describe 'client.indices#flush_synced' do
|
30
|
-
|
31
|
-
let(:expected_args) do
|
32
|
-
[
|
33
|
-
'POST',
|
34
|
-
url,
|
35
|
-
params,
|
36
|
-
nil,
|
37
|
-
{}
|
38
|
-
]
|
39
|
-
end
|
40
|
-
|
41
|
-
let(:params) do
|
42
|
-
{}
|
43
|
-
end
|
44
|
-
|
45
|
-
let(:url) do
|
46
|
-
'foo/_flush/synced'
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'performs the request' do
|
50
|
-
expect(client_double.indices.flush_synced(index: 'foo')).to eq({})
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when a \'not found\' exception is raised' do
|
54
|
-
|
55
|
-
let(:client) do
|
56
|
-
Class.new { include OpenSearch::API }.new.tap do |_client|
|
57
|
-
expect(_client).to receive(:perform_request).with(*expected_args).and_raise(NotFound)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'raises the exception' do
|
62
|
-
expect {
|
63
|
-
client.indices.flush_synced(index: 'foo')
|
64
|
-
}.to raise_exception(NotFound)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when a \'not found\' exception is raised' do
|
69
|
-
|
70
|
-
let(:client) do
|
71
|
-
Class.new { include OpenSearch::API }.new.tap do |_client|
|
72
|
-
expect(_client).to receive(:perform_request).with(*expected_args).and_raise(NotFound)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'raises the exception' do
|
77
|
-
expect {
|
78
|
-
client.indices.flush_synced(index: 'foo')
|
79
|
-
}.to raise_exception(NotFound)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'when the ignore parameter is specified' do
|
84
|
-
|
85
|
-
let(:client) do
|
86
|
-
Class.new { include OpenSearch::API }.new.tap do |_client|
|
87
|
-
expect(_client).to receive(:perform_request).with(*expected_args).and_raise(StandardError.new('404 Not Found'))
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
let(:params) do
|
92
|
-
{ ignore: 404 }
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'does not raise the exception' do
|
96
|
-
expect(client.indices.flush_synced(index: 'foo', ignore: 404)).to eq(false)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
#
|
3
|
-
# The OpenSearch Contributors require contributions made to
|
4
|
-
# this file be licensed under the Apache-2.0 license or a
|
5
|
-
# compatible open source license.
|
6
|
-
#
|
7
|
-
# Modifications Copyright OpenSearch Contributors. See
|
8
|
-
# GitHub history for details.
|
9
|
-
#
|
10
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
-
# license agreements. See the NOTICE file distributed with
|
12
|
-
# this work for additional information regarding copyright
|
13
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
-
# not use this file except in compliance with the License.
|
16
|
-
# You may obtain a copy of the License at
|
17
|
-
#
|
18
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
-
#
|
20
|
-
# Unless required by applicable law or agreed to in writing,
|
21
|
-
# software distributed under the License is distributed on an
|
22
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
-
# KIND, either express or implied. See the License for the
|
24
|
-
# specific language governing permissions and limitations
|
25
|
-
# under the License.
|
26
|
-
|
27
|
-
require 'spec_helper'
|
28
|
-
|
29
|
-
describe 'client#open_point_in_time' do
|
30
|
-
let(:expected_args) do
|
31
|
-
[
|
32
|
-
'POST',
|
33
|
-
url,
|
34
|
-
{},
|
35
|
-
nil,
|
36
|
-
{}
|
37
|
-
]
|
38
|
-
end
|
39
|
-
|
40
|
-
let (:url) { '_pit'}
|
41
|
-
|
42
|
-
it 'performs the request' do
|
43
|
-
expect(client_double.open_point_in_time).to eq({})
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'with index' do
|
47
|
-
let (:url) { 'foo/_pit'}
|
48
|
-
|
49
|
-
it 'performs the request' do
|
50
|
-
expect(client_double.open_point_in_time(index: 'foo')).to eq({})
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|