opensearch-api 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile +2 -2
- data/README.md +3 -3
- data/Rakefile +3 -3
- data/lib/opensearch/api/actions/benchmark.rb +0 -1
- data/lib/opensearch/api/actions/bulk.rb +1 -7
- 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/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/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_by_query.rb +1 -8
- 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_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 +0 -1
- data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
- 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/count_spec.rb +3 -3
- data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
- 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/exists_document_spec.rb +10 -10
- data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
- 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 +14 -31
- metadata.gz.sig +0 -0
- data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
- data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
- data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
- data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
@@ -30,7 +30,7 @@ describe 'client#mtermvectors' do
|
|
30
30
|
let(:expected_args) do
|
31
31
|
[
|
32
32
|
method,
|
33
|
-
'my-index/
|
33
|
+
'my-index/_mtermvectors',
|
34
34
|
{},
|
35
35
|
body,
|
36
36
|
{}
|
@@ -43,13 +43,13 @@ describe 'client#mtermvectors' do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'performs the request' do
|
46
|
-
expect(client_double.mtermvectors(index: 'my-index',
|
46
|
+
expect(client_double.mtermvectors(index: 'my-index', body: { ids: [1, 2, 3] })).to eq({})
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'when a list of ids is passed instead of a body' do
|
50
50
|
let(:method) { 'GET' }
|
51
51
|
it 'performs the request' do
|
52
|
-
expect(client_double.mtermvectors(index: 'my-index',
|
52
|
+
expect(client_double.mtermvectors(index: 'my-index', ids: [1, 2, 3])).to eq({})
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -47,11 +47,11 @@ describe 'client#search' do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
let(:url) do
|
50
|
-
'
|
50
|
+
'_search'
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'has a default value for index' do
|
54
|
-
expect(client_double.search(
|
54
|
+
expect(client_double.search())
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'when a request definition is specified' do
|
@@ -80,14 +80,14 @@ describe 'client#search' do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
context 'when an index
|
83
|
+
context 'when an index is specified' do
|
84
84
|
|
85
85
|
let(:url) do
|
86
|
-
'foo/
|
86
|
+
'foo/_search'
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'performs the request' do
|
90
|
-
expect(client_double.search(index: 'foo'
|
90
|
+
expect(client_double.search(index: 'foo'))
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -102,17 +102,6 @@ describe 'client#search' do
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
context 'when multiple indices and types are specified' do
|
106
|
-
|
107
|
-
let(:url) do
|
108
|
-
'foo,bar/lam,bam/_search'
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'performs the request' do
|
112
|
-
expect(client_double.search(index: ['foo', 'bar'], type: ['lam', 'bam']))
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
105
|
context 'when there are URL params' do
|
117
106
|
|
118
107
|
let(:url) do
|
@@ -38,7 +38,7 @@ describe 'client#termvectors' do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
let(:url) do
|
41
|
-
'foo/
|
41
|
+
'foo/_termvectors/123'
|
42
42
|
end
|
43
43
|
|
44
44
|
let(:params) do
|
@@ -55,21 +55,21 @@ describe 'client#termvectors' do
|
|
55
55
|
|
56
56
|
it 'requires the :index argument' do
|
57
57
|
expect {
|
58
|
-
client.termvectors(
|
58
|
+
client.termvectors(id: '1')
|
59
59
|
}.to raise_exception(ArgumentError)
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'performs the request' do
|
63
|
-
expect(client_double.termvectors(index: 'foo',
|
63
|
+
expect(client_double.termvectors(index: 'foo', id: '123', body: {})).to eq({})
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'when the older api name \'termvector\' is used' do
|
67
67
|
let(:url) do
|
68
|
-
'foo/
|
68
|
+
'foo/_termvector/123'
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'performs the request' do
|
72
|
-
expect(client_double.termvector(index: 'foo',
|
72
|
+
expect(client_double.termvector(index: 'foo', id: '123', body: {})).to eq({})
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -43,7 +43,7 @@ describe 'client#update' do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
let(:url) do
|
46
|
-
'foo/
|
46
|
+
'foo/_update/1'
|
47
47
|
end
|
48
48
|
|
49
49
|
let(:client) do
|
@@ -56,24 +56,24 @@ describe 'client#update' do
|
|
56
56
|
|
57
57
|
it 'requires the :index argument' do
|
58
58
|
expect {
|
59
|
-
client.update(
|
59
|
+
client.update(id: '1')
|
60
60
|
}.to raise_exception(ArgumentError)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'requires the :id argument' do
|
64
64
|
expect {
|
65
|
-
client.update(index: 'foo'
|
65
|
+
client.update(index: 'foo')
|
66
66
|
}.to raise_exception(ArgumentError)
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'performs the request' do
|
70
|
-
expect(client_double.update(index: 'foo',
|
70
|
+
expect(client_double.update(index: 'foo', id: '1', body: { doc: {} })).to eq({})
|
71
71
|
end
|
72
72
|
|
73
73
|
context 'when URL parameters are provided' do
|
74
74
|
|
75
75
|
let(:url) do
|
76
|
-
'foo/
|
76
|
+
'foo/_update/1'
|
77
77
|
end
|
78
78
|
|
79
79
|
let(:body) do
|
@@ -81,7 +81,7 @@ describe 'client#update' do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'performs the request' do
|
84
|
-
expect(client_double.update(index: 'foo',
|
84
|
+
expect(client_double.update(index: 'foo', id: '1', body: {}))
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -89,7 +89,7 @@ describe 'client#update' do
|
|
89
89
|
|
90
90
|
it 'raises an ArgumentError' do
|
91
91
|
expect {
|
92
|
-
client.update(index: 'foo',
|
92
|
+
client.update(index: 'foo', id: '1', body: { doc: {} }, qwertypoiuy: 'asdflkjhg')
|
93
93
|
}.to raise_exception(ArgumentError)
|
94
94
|
end
|
95
95
|
end
|
@@ -97,7 +97,7 @@ describe 'client#update' do
|
|
97
97
|
context 'when the request needs to be URL-escaped' do
|
98
98
|
|
99
99
|
let(:url) do
|
100
|
-
'foo%5Ebar/
|
100
|
+
'foo%5Ebar/_update/1'
|
101
101
|
end
|
102
102
|
|
103
103
|
let(:body) do
|
@@ -105,7 +105,7 @@ describe 'client#update' do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'escapes the parts' do
|
108
|
-
expect(client_double.update(index: 'foo^bar',
|
108
|
+
expect(client_double.update(index: 'foo^bar', id: '1', body: {}))
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -117,14 +117,14 @@ describe 'client#update' do
|
|
117
117
|
|
118
118
|
it 'raises it to the user' do
|
119
119
|
expect {
|
120
|
-
client.update(index: 'foo',
|
120
|
+
client.update(index: 'foo', id: 'XXX', body: {})
|
121
121
|
}.to raise_exception(NotFound)
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'when the :ignore parameter is specified' do
|
125
125
|
|
126
126
|
it 'does not raise the error to the user' do
|
127
|
-
expect(client.update(index: 'foo',
|
127
|
+
expect(client.update(index: 'foo', id: 'XXX', body: {}, ignore: 404)).to eq(false)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
@@ -48,17 +48,10 @@ describe OpenSearch::API::Utils do
|
|
48
48
|
expect(utils.__escape('*')).to eq('*')
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
51
|
+
it 'uses CGI.escape by default' do
|
52
52
|
expect(CGI).to receive(:escape).and_call_original
|
53
53
|
expect(utils.__escape('foo bar')).to eq('foo+bar')
|
54
54
|
end
|
55
|
-
|
56
|
-
it 'uses the escape_utils gem when available', unless: defined?(JRUBY_VERSION) do
|
57
|
-
require 'escape_utils'
|
58
|
-
expect(CGI).not_to receive(:escape)
|
59
|
-
expect(EscapeUtils).to receive(:escape_url).and_call_original
|
60
|
-
expect(utils.__escape('foo bar')).to eq('foo+bar')
|
61
|
-
end
|
62
55
|
end
|
63
56
|
|
64
57
|
describe '#__listify' do
|
@@ -116,19 +109,19 @@ describe OpenSearch::API::Utils do
|
|
116
109
|
|
117
110
|
let(:result) do
|
118
111
|
utils.__bulkify [
|
119
|
-
{ :index => { :_index => 'myindexA', :
|
120
|
-
{ :update => { :_index => 'myindexB', :
|
121
|
-
{ :delete => { :_index => 'myindexC', :
|
112
|
+
{ :index => { :_index => 'myindexA', :_id => '1', :data => { :title => 'Test' } } },
|
113
|
+
{ :update => { :_index => 'myindexB', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
|
114
|
+
{ :delete => { :_index => 'myindexC', :_id => '3' } }
|
122
115
|
]
|
123
116
|
end
|
124
117
|
|
125
118
|
let(:expected_string) do
|
126
119
|
<<-PAYLOAD.gsub(/^\s+/, '')
|
127
|
-
{"index":{"_index":"myindexA","
|
120
|
+
{"index":{"_index":"myindexA","_id":"1"}}
|
128
121
|
{"title":"Test"}
|
129
|
-
{"update":{"_index":"myindexB","
|
122
|
+
{"update":{"_index":"myindexB","_id":"2"}}
|
130
123
|
{"doc":{"title":"Update"}}
|
131
|
-
{"delete":{"_index":"myindexC","
|
124
|
+
{"delete":{"_index":"myindexC","_id":"3"}}
|
132
125
|
PAYLOAD
|
133
126
|
end
|
134
127
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opensearch-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayesh Hathila
|
@@ -15,7 +15,7 @@ cert_chain:
|
|
15
15
|
-----BEGIN CERTIFICATE-----
|
16
16
|
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRMwEQYDVQQDDApvcGVu
|
17
17
|
c2VhcmNoMRYwFAYKCZImiZPyLGQBGRYGYW1hem9uMRMwEQYKCZImiZPyLGQBGRYD
|
18
|
-
|
18
|
+
Y29tMB4XDTIyMDgxNzE3NTIzNFoXDTIzMDgxNzE3NTIzNFowQjETMBEGA1UEAwwK
|
19
19
|
b3BlbnNlYXJjaDEWMBQGCgmSJomT8ixkARkWBmFtYXpvbjETMBEGCgmSJomT8ixk
|
20
20
|
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM1z3/jcitjV
|
21
21
|
umXwRFn+JSBBd36qZB54Dtucf6+E2fmNPzBRhgYN5XJy/+clQJ9NIJV7C8H52P3V
|
@@ -26,14 +26,14 @@ cert_chain:
|
|
26
26
|
zfR37/NQFkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
27
27
|
BBYEFJJ2myhLXK742btavNbG0IWrMNBIMCAGA1UdEQQZMBeBFW9wZW5zZWFyY2hA
|
28
28
|
YW1hem9uLmNvbTAgBgNVHRIEGTAXgRVvcGVuc2VhcmNoQGFtYXpvbi5jb20wDQYJ
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
KoZIhvcNAQEFBQADggEBAH5pWLYwKWFh1OjdCReGz/VEAiF4jXXputoN5Z8ga+1Z
|
30
|
+
lg8/diJf0PlP2B46PdmxH/TVc/o+qglNO2cHVEp8xZfEd83dfioOBeK90URQUpC5
|
31
|
+
UZmO0LZusg46SQKwKa2ukpIy2fNi3PeHRiV+W2Zv69GoWppyLun+fMez7wVoah2r
|
32
|
+
r5ROUYuAvFUvga1Vm+49pKiPM5n+MAYP5t/vWhgymY3SYQ1TfewkvKAFiFXikOR+
|
33
|
+
r+j7FLyKuk5DzIxiCp8QN5dU71BbGUmsHf/C5UV76WLPOFX/szeaHhPwpjR3sK7r
|
34
|
+
5zLgCV1KP7cgDdCYMlmZGeSViU8NV+Yy8/ghrzGpqVw=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date:
|
36
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: multi_json
|
@@ -245,20 +245,6 @@ dependencies:
|
|
245
245
|
- - ">="
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
|
-
- !ruby/object:Gem::Dependency
|
249
|
-
name: escape_utils
|
250
|
-
requirement: !ruby/object:Gem::Requirement
|
251
|
-
requirements:
|
252
|
-
- - ">="
|
253
|
-
- !ruby/object:Gem::Version
|
254
|
-
version: '0'
|
255
|
-
type: :development
|
256
|
-
prerelease: false
|
257
|
-
version_requirements: !ruby/object:Gem::Requirement
|
258
|
-
requirements:
|
259
|
-
- - ">="
|
260
|
-
- !ruby/object:Gem::Version
|
261
|
-
version: '0'
|
262
248
|
- !ruby/object:Gem::Dependency
|
263
249
|
name: jbuilder
|
264
250
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,7 +317,7 @@ dependencies:
|
|
331
317
|
version: '0'
|
332
318
|
description: 'Ruby API for OpenSearch. See the `opensearch` gem for full integration.
|
333
319
|
|
334
|
-
'
|
320
|
+
'
|
335
321
|
email:
|
336
322
|
- jayehh@amazon.com
|
337
323
|
- vamshin@amazon.com
|
@@ -355,6 +341,7 @@ files:
|
|
355
341
|
- lib/opensearch/api/actions/bulk.rb
|
356
342
|
- lib/opensearch/api/actions/cat/aliases.rb
|
357
343
|
- lib/opensearch/api/actions/cat/allocation.rb
|
344
|
+
- lib/opensearch/api/actions/cat/cluster_manager.rb
|
358
345
|
- lib/opensearch/api/actions/cat/count.rb
|
359
346
|
- lib/opensearch/api/actions/cat/fielddata.rb
|
360
347
|
- lib/opensearch/api/actions/cat/health.rb
|
@@ -431,10 +418,8 @@ files:
|
|
431
418
|
- lib/opensearch/api/actions/indices/exists_alias.rb
|
432
419
|
- lib/opensearch/api/actions/indices/exists_index_template.rb
|
433
420
|
- lib/opensearch/api/actions/indices/exists_template.rb
|
434
|
-
- lib/opensearch/api/actions/indices/exists_type.rb
|
435
421
|
- lib/opensearch/api/actions/indices/field_usage_stats.rb
|
436
422
|
- lib/opensearch/api/actions/indices/flush.rb
|
437
|
-
- lib/opensearch/api/actions/indices/flush_synced.rb
|
438
423
|
- lib/opensearch/api/actions/indices/forcemerge.rb
|
439
424
|
- lib/opensearch/api/actions/indices/get.rb
|
440
425
|
- lib/opensearch/api/actions/indices/get_alias.rb
|
@@ -545,6 +530,7 @@ files:
|
|
545
530
|
- spec/opensearch/api/actions/bulk_spec.rb
|
546
531
|
- spec/opensearch/api/actions/cat/aliases_spec.rb
|
547
532
|
- spec/opensearch/api/actions/cat/allocation_spec.rb
|
533
|
+
- spec/opensearch/api/actions/cat/cluster_manager_spec.rb
|
548
534
|
- spec/opensearch/api/actions/cat/count_spec.rb
|
549
535
|
- spec/opensearch/api/actions/cat/fielddata_spec.rb
|
550
536
|
- spec/opensearch/api/actions/cat/health_spec.rb
|
@@ -605,10 +591,8 @@ files:
|
|
605
591
|
- spec/opensearch/api/actions/indices/exists_alias_spec.rb
|
606
592
|
- spec/opensearch/api/actions/indices/exists_spec.rb
|
607
593
|
- spec/opensearch/api/actions/indices/exists_template_spec.rb
|
608
|
-
- spec/opensearch/api/actions/indices/exists_type_spec.rb
|
609
594
|
- spec/opensearch/api/actions/indices/field_usage_stats_spec.rb
|
610
595
|
- spec/opensearch/api/actions/indices/flush_spec.rb
|
611
|
-
- spec/opensearch/api/actions/indices/flush_synced_spec.rb
|
612
596
|
- spec/opensearch/api/actions/indices/forcemerge_spec.rb
|
613
597
|
- spec/opensearch/api/actions/indices/get_alias_spec.rb
|
614
598
|
- spec/opensearch/api/actions/indices/get_field_mapping_spec.rb
|
@@ -708,7 +692,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
708
692
|
- !ruby/object:Gem::Version
|
709
693
|
version: '0'
|
710
694
|
requirements: []
|
711
|
-
rubygems_version: 3.
|
695
|
+
rubygems_version: 3.3.26
|
712
696
|
signing_key:
|
713
697
|
specification_version: 4
|
714
698
|
summary: Ruby API for OpenSearch.
|
@@ -718,6 +702,7 @@ test_files:
|
|
718
702
|
- spec/opensearch/api/actions/bulk_spec.rb
|
719
703
|
- spec/opensearch/api/actions/cat/aliases_spec.rb
|
720
704
|
- spec/opensearch/api/actions/cat/allocation_spec.rb
|
705
|
+
- spec/opensearch/api/actions/cat/cluster_manager_spec.rb
|
721
706
|
- spec/opensearch/api/actions/cat/count_spec.rb
|
722
707
|
- spec/opensearch/api/actions/cat/fielddata_spec.rb
|
723
708
|
- spec/opensearch/api/actions/cat/health_spec.rb
|
@@ -778,10 +763,8 @@ test_files:
|
|
778
763
|
- spec/opensearch/api/actions/indices/exists_alias_spec.rb
|
779
764
|
- spec/opensearch/api/actions/indices/exists_spec.rb
|
780
765
|
- spec/opensearch/api/actions/indices/exists_template_spec.rb
|
781
|
-
- spec/opensearch/api/actions/indices/exists_type_spec.rb
|
782
766
|
- spec/opensearch/api/actions/indices/field_usage_stats_spec.rb
|
783
767
|
- spec/opensearch/api/actions/indices/flush_spec.rb
|
784
|
-
- spec/opensearch/api/actions/indices/flush_synced_spec.rb
|
785
768
|
- spec/opensearch/api/actions/indices/forcemerge_spec.rb
|
786
769
|
- spec/opensearch/api/actions/indices/get_alias_spec.rb
|
787
770
|
- spec/opensearch/api/actions/indices/get_field_mapping_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,79 +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
|
-
module OpenSearch
|
28
|
-
module API
|
29
|
-
module Indices
|
30
|
-
module Actions
|
31
|
-
# Returns information about whether a particular document type exists. (DEPRECATED)
|
32
|
-
#
|
33
|
-
# @option arguments [List] :index A comma-separated list of index names; use `_all` to check the types across all indices
|
34
|
-
# @option arguments [List] :type A comma-separated list of document types to check
|
35
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
36
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
37
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
|
38
|
-
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
39
|
-
# @option arguments [Hash] :headers Custom HTTP headers
|
40
|
-
#
|
41
|
-
#
|
42
|
-
def exists_type(arguments = {})
|
43
|
-
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
44
|
-
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
45
|
-
|
46
|
-
headers = arguments.delete(:headers) || {}
|
47
|
-
|
48
|
-
arguments = arguments.clone
|
49
|
-
|
50
|
-
_index = arguments.delete(:index)
|
51
|
-
|
52
|
-
_type = arguments.delete(:type)
|
53
|
-
|
54
|
-
method = OpenSearch::API::HTTP_HEAD
|
55
|
-
path = "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}"
|
56
|
-
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
57
|
-
|
58
|
-
body = nil
|
59
|
-
|
60
|
-
Utils.__rescue_from_not_found do
|
61
|
-
perform_request(method, path, params, body, headers).status == 200 ? true : false
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
alias_method :exists_type?, :exists_type
|
66
|
-
|
67
|
-
# Register this action with its valid params when the module is loaded.
|
68
|
-
#
|
69
|
-
# @since 6.2.0
|
70
|
-
ParamsRegistry.register(:exists_type, [
|
71
|
-
:ignore_unavailable,
|
72
|
-
:allow_no_indices,
|
73
|
-
:expand_wildcards,
|
74
|
-
:local
|
75
|
-
].freeze)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,79 +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
|
-
module OpenSearch
|
28
|
-
module API
|
29
|
-
module Indices
|
30
|
-
module Actions
|
31
|
-
# Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead
|
32
|
-
#
|
33
|
-
# @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices
|
34
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
35
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
36
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
|
37
|
-
# @option arguments [Hash] :headers Custom HTTP headers
|
38
|
-
#
|
39
|
-
# *Deprecation notice*:
|
40
|
-
# Synced flush is deprecated and will be removed in 8.0. Use flush instead.
|
41
|
-
# Deprecated since version 7.6.0
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
def flush_synced(arguments = {})
|
46
|
-
headers = arguments.delete(:headers) || {}
|
47
|
-
|
48
|
-
arguments = arguments.clone
|
49
|
-
|
50
|
-
_index = arguments.delete(:index)
|
51
|
-
|
52
|
-
method = OpenSearch::API::HTTP_POST
|
53
|
-
path = if _index
|
54
|
-
"#{Utils.__listify(_index)}/_flush/synced"
|
55
|
-
else
|
56
|
-
"_flush/synced"
|
57
|
-
end
|
58
|
-
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
59
|
-
|
60
|
-
body = nil
|
61
|
-
if Array(arguments[:ignore]).include?(404)
|
62
|
-
Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
|
63
|
-
else
|
64
|
-
perform_request(method, path, params, body, headers).body
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# Register this action with its valid params when the module is loaded.
|
69
|
-
#
|
70
|
-
# @since 6.2.0
|
71
|
-
ParamsRegistry.register(:flush_synced, [
|
72
|
-
:ignore_unavailable,
|
73
|
-
:allow_no_indices,
|
74
|
-
:expand_wildcards
|
75
|
-
].freeze)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -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
|