opensearch-api 1.0.0 → 2.0.2
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/README.md +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/count.rb +1 -6
- data/lib/opensearch/api/actions/create.rb +0 -1
- 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/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/get.rb +1 -8
- 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/create.rb +0 -2
- data/lib/opensearch/api/actions/indices/get.rb +0 -2
- data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
- data/lib/opensearch/api/actions/indices/get_mapping.rb +1 -10
- data/lib/opensearch/api/actions/indices/get_template.rb +0 -2
- data/lib/opensearch/api/actions/indices/put_mapping.rb +1 -12
- data/lib/opensearch/api/actions/indices/put_template.rb +0 -2
- data/lib/opensearch/api/actions/indices/rollover.rb +0 -2
- data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
- 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/search.rb +1 -7
- data/lib/opensearch/api/actions/search_template.rb +1 -6
- 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 +1 -1
- 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/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/index_document_spec.rb +12 -12
- 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 +1 -8
- data.tar.gz.sig +0 -0
- metadata +2 -22
- 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
@@ -43,7 +43,7 @@ describe 'client#get' do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
let(:url) do
|
46
|
-
'foo/
|
46
|
+
'foo/_doc/1'
|
47
47
|
end
|
48
48
|
|
49
49
|
let(:client) do
|
@@ -52,13 +52,13 @@ describe 'client#get' do
|
|
52
52
|
|
53
53
|
it 'requires the :index argument' do
|
54
54
|
expect {
|
55
|
-
client.get(
|
55
|
+
client.get(id: '1')
|
56
56
|
}.to raise_exception(ArgumentError)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'requires the :id argument' do
|
60
60
|
expect {
|
61
|
-
client.get(index: 'foo'
|
61
|
+
client.get(index: 'foo')
|
62
62
|
}.to raise_exception(ArgumentError)
|
63
63
|
end
|
64
64
|
|
@@ -80,7 +80,7 @@ describe 'client#get' do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'Passes the URL params' do
|
83
|
-
expect(client_double.get(index: 'foo',
|
83
|
+
expect(client_double.get(index: 'foo', id: '1', routing: 'abc123')).to eq({})
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -88,7 +88,7 @@ describe 'client#get' do
|
|
88
88
|
|
89
89
|
it 'Passes the URL params' do
|
90
90
|
expect {
|
91
|
-
client.get(index: 'foo',
|
91
|
+
client.get(index: 'foo', id: '1', qwert: 'abc123')
|
92
92
|
}.to raise_exception(ArgumentError)
|
93
93
|
end
|
94
94
|
end
|
@@ -96,11 +96,11 @@ describe 'client#get' do
|
|
96
96
|
context 'when the request needs to be URL-escaped' do
|
97
97
|
|
98
98
|
let(:url) do
|
99
|
-
'foo%5Ebar/
|
99
|
+
'foo%5Ebar/_doc/1'
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'URL-escapes the parts' do
|
103
|
-
expect(client_double.get(index: 'foo^bar',
|
103
|
+
expect(client_double.get(index: 'foo^bar', id: '1')).to eq({})
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -125,7 +125,7 @@ describe 'client#get' do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'returns false' do
|
128
|
-
expect(client.get(index: 'foo',
|
128
|
+
expect(client.get(index: 'foo', id: '1', ignore: 404)).to eq(false)
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -47,7 +47,7 @@ describe 'client#index' do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
let(:url) do
|
50
|
-
'foo/
|
50
|
+
'foo/_doc'
|
51
51
|
end
|
52
52
|
|
53
53
|
let(:body) do
|
@@ -60,12 +60,12 @@ describe 'client#index' do
|
|
60
60
|
|
61
61
|
it 'requires the :index argument' do
|
62
62
|
expect {
|
63
|
-
client.index(
|
63
|
+
client.index()
|
64
64
|
}.to raise_exception(ArgumentError)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'performs the request' do
|
68
|
-
expect(client_double.index(index: 'foo',
|
68
|
+
expect(client_double.index(index: 'foo', body: body)).to eq({})
|
69
69
|
end
|
70
70
|
|
71
71
|
context 'when a specific id is provided' do
|
@@ -75,11 +75,11 @@ describe 'client#index' do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
let(:url) do
|
78
|
-
'foo/
|
78
|
+
'foo/_doc/1'
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'performs the request' do
|
82
|
-
expect(client_double.index(index: 'foo',
|
82
|
+
expect(client_double.index(index: 'foo', id: '1', body: body)).to eq({})
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -90,7 +90,7 @@ describe 'client#index' do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
let(:url) do
|
93
|
-
'foo/
|
93
|
+
'foo/_doc'
|
94
94
|
end
|
95
95
|
|
96
96
|
let(:params) do
|
@@ -98,7 +98,7 @@ describe 'client#index' do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it 'passes the URL params' do
|
101
|
-
expect(client_double.index(index: 'foo',
|
101
|
+
expect(client_double.index(index: 'foo', op_type: 'create', body: body)).to eq({})
|
102
102
|
end
|
103
103
|
|
104
104
|
context 'when a specific id is provided' do
|
@@ -108,7 +108,7 @@ describe 'client#index' do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
let(:url) do
|
111
|
-
'foo/
|
111
|
+
'foo/_doc/1'
|
112
112
|
end
|
113
113
|
|
114
114
|
let(:params) do
|
@@ -116,7 +116,7 @@ describe 'client#index' do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'passes the URL params' do
|
119
|
-
expect(client_double.index(index: 'foo',
|
119
|
+
expect(client_double.index(index: 'foo', id: '1', op_type: 'create', body: body)).to eq({})
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -127,11 +127,11 @@ describe 'client#index' do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
let(:url) do
|
130
|
-
'foo
|
130
|
+
'foo%5Ebar/_doc/123'
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'URL-escapes the parts' do
|
134
|
-
expect(client_double.index(index: 'foo
|
134
|
+
expect(client_double.index(index: 'foo^bar', id: '123', body: body)).to eq({})
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -139,7 +139,7 @@ describe 'client#index' do
|
|
139
139
|
|
140
140
|
it 'raises and ArgumentError' do
|
141
141
|
expect {
|
142
|
-
client.index(index: 'foo',
|
142
|
+
client.index(index: 'foo', id: '1', qwerty: 'yuiop')
|
143
143
|
}.to raise_exception(ArgumentError)
|
144
144
|
end
|
145
145
|
end
|
@@ -56,15 +56,4 @@ describe 'client.cluster#get_field_mapping' do
|
|
56
56
|
expect(client_double.indices.get_field_mapping(index: 'foo', field: 'bam')).to eq({})
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
60
|
-
context 'when a type is specified' do
|
61
|
-
|
62
|
-
let(:url) do
|
63
|
-
'foo/_mapping/bar/field/bam'
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'performs the request' do
|
67
|
-
expect(client_double.indices.get_field_mapping(index: 'foo', type: 'bar', field: 'bam')).to eq({})
|
68
|
-
end
|
69
|
-
end
|
70
59
|
end
|
@@ -57,36 +57,25 @@ describe 'client.cluster#get_mapping' do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context 'when
|
60
|
+
context 'when multiple indices are specified' do
|
61
61
|
|
62
62
|
let(:url) do
|
63
|
-
'foo/_mapping
|
63
|
+
'foo,bar/_mapping'
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'performs the request' do
|
67
|
-
expect(client_double.indices.get_mapping(index: 'foo',
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'when multiple indices and types are specified' do
|
72
|
-
|
73
|
-
let(:url) do
|
74
|
-
'foo,bar/_mapping/bam,baz'
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'performs the request' do
|
78
|
-
expect(client_double.indices.get_mapping(index: ['foo', 'bar'], type: ['bam', 'baz'])).to eq({})
|
67
|
+
expect(client_double.indices.get_mapping(index: ['foo', 'bar'])).to eq({})
|
79
68
|
end
|
80
69
|
end
|
81
70
|
|
82
71
|
context 'when the path must be URL-escaped' do
|
83
72
|
|
84
73
|
let(:url) do
|
85
|
-
'foo%5Ebar/_mapping
|
74
|
+
'foo%5Ebar/_mapping'
|
86
75
|
end
|
87
76
|
|
88
77
|
it 'performs the request' do
|
89
|
-
expect(client_double.indices.get_mapping(index: 'foo^bar'
|
78
|
+
expect(client_double.indices.get_mapping(index: 'foo^bar')).to eq({})
|
90
79
|
end
|
91
80
|
end
|
92
81
|
end
|
@@ -39,7 +39,7 @@ describe 'client.cluster#put_mapping' do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
let(:url) do
|
42
|
-
'foo/
|
42
|
+
'foo/_mappings'
|
43
43
|
end
|
44
44
|
|
45
45
|
let(:body) do
|
@@ -47,20 +47,7 @@ describe 'client.cluster#put_mapping' do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'performs the request' do
|
50
|
-
expect(client_double.indices.put_mapping(index: 'foo',
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when there is no type specified' do
|
54
|
-
|
55
|
-
let(:client) do
|
56
|
-
Class.new { include OpenSearch::API }.new
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'raises an exception' do
|
60
|
-
expect {
|
61
|
-
client.indices.put_mapping(type: 'foo')
|
62
|
-
}.to raise_exception(ArgumentError)
|
63
|
-
end
|
50
|
+
expect(client_double.indices.put_mapping(index: 'foo', body: {})).to eq({})
|
64
51
|
end
|
65
52
|
|
66
53
|
context 'when there is no body specified' do
|
@@ -71,7 +58,7 @@ describe 'client.cluster#put_mapping' do
|
|
71
58
|
|
72
59
|
it 'raises an exception' do
|
73
60
|
expect {
|
74
|
-
client.indices.put_mapping(index: 'foo'
|
61
|
+
client.indices.put_mapping(index: 'foo')
|
75
62
|
}.to raise_exception(ArgumentError)
|
76
63
|
end
|
77
64
|
end
|
@@ -83,29 +70,29 @@ describe 'client.cluster#put_mapping' do
|
|
83
70
|
end
|
84
71
|
|
85
72
|
it 'performs the request' do
|
86
|
-
expect(client_double.indices.put_mapping(index: 'foo',
|
73
|
+
expect(client_double.indices.put_mapping(index: 'foo', body: { filter: 'foo' })).to eq({})
|
87
74
|
end
|
88
75
|
end
|
89
76
|
|
90
77
|
context 'when multiple indices are specified' do
|
91
78
|
|
92
79
|
let(:url) do
|
93
|
-
'foo,bar/
|
80
|
+
'foo,bar/_mappings'
|
94
81
|
end
|
95
82
|
|
96
83
|
it 'performs the request' do
|
97
|
-
expect(client_double.indices.put_mapping(index: ['foo','bar'],
|
84
|
+
expect(client_double.indices.put_mapping(index: ['foo','bar'], body: {})).to eq({})
|
98
85
|
end
|
99
86
|
end
|
100
87
|
|
101
88
|
context 'when the path needs to be URL-escaped' do
|
102
89
|
|
103
90
|
let(:url) do
|
104
|
-
'foo%5Ebar/
|
91
|
+
'foo%5Ebar/_mappings'
|
105
92
|
end
|
106
93
|
|
107
94
|
it 'performs the request' do
|
108
|
-
expect(client_double.indices.put_mapping(index: 'foo^bar',
|
95
|
+
expect(client_double.indices.put_mapping(index: 'foo^bar', body: {})).to eq({})
|
109
96
|
end
|
110
97
|
end
|
111
98
|
end
|
@@ -64,16 +64,6 @@ describe 'client.cluster#validate_query' do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
context 'when a type and index are specified' do
|
68
|
-
let(:url) do
|
69
|
-
'foo/bar/_validate/query'
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'performs the request' do
|
73
|
-
expect(client_double.indices.validate_query(index: 'foo', type: 'bar')).to eq({})
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
67
|
context 'when multiple indicies are specified as a list' do
|
78
68
|
let(:url) do
|
79
69
|
'foo,bar/_validate/query'
|
@@ -64,21 +64,6 @@ describe 'client#mget' do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
context 'when a type is specified' do
|
68
|
-
|
69
|
-
let(:url) do
|
70
|
-
'foo/bar/_mget'
|
71
|
-
end
|
72
|
-
|
73
|
-
let(:body) do
|
74
|
-
{ ids: [ '1', '2' ]}
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'performs the request' do
|
78
|
-
expect(client_double.mget(index: 'foo', type: 'bar', body: { :ids => [ '1', '2'] })).to eq({})
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
67
|
context 'when url parameters are provided' do
|
83
68
|
|
84
69
|
let(:params) do
|
@@ -97,7 +82,7 @@ describe 'client#mget' do
|
|
97
82
|
context 'when the request needs to be URL-escaped' do
|
98
83
|
|
99
84
|
let(:url) do
|
100
|
-
'foo%5Ebar/
|
85
|
+
'foo%5Ebar/_mget'
|
101
86
|
end
|
102
87
|
|
103
88
|
let(:body) do
|
@@ -105,7 +90,7 @@ describe 'client#mget' do
|
|
105
90
|
end
|
106
91
|
|
107
92
|
it 'performs the request' do
|
108
|
-
expect(client_double.mget(index: 'foo^bar',
|
93
|
+
expect(client_double.mget(index: 'foo^bar', body: { :ids => [ '1', '2'] })).to eq({})
|
109
94
|
end
|
110
95
|
end
|
111
96
|
end
|
@@ -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
|
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:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayesh Hathila
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
yXikuH6LEVykA8pgOcB9gKsB2/zMd2ZlSj2monM8Qw9EfB14ZSDTYS8VYuwWCeF0
|
34
34
|
eFmXXk0ufQFKl1Yll7quHkmQ0PzKkvXTpONBT6qPkXE=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date:
|
36
|
+
date: 2022-06-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
|
@@ -431,10 +417,8 @@ files:
|
|
431
417
|
- lib/opensearch/api/actions/indices/exists_alias.rb
|
432
418
|
- lib/opensearch/api/actions/indices/exists_index_template.rb
|
433
419
|
- lib/opensearch/api/actions/indices/exists_template.rb
|
434
|
-
- lib/opensearch/api/actions/indices/exists_type.rb
|
435
420
|
- lib/opensearch/api/actions/indices/field_usage_stats.rb
|
436
421
|
- lib/opensearch/api/actions/indices/flush.rb
|
437
|
-
- lib/opensearch/api/actions/indices/flush_synced.rb
|
438
422
|
- lib/opensearch/api/actions/indices/forcemerge.rb
|
439
423
|
- lib/opensearch/api/actions/indices/get.rb
|
440
424
|
- lib/opensearch/api/actions/indices/get_alias.rb
|
@@ -605,10 +589,8 @@ files:
|
|
605
589
|
- spec/opensearch/api/actions/indices/exists_alias_spec.rb
|
606
590
|
- spec/opensearch/api/actions/indices/exists_spec.rb
|
607
591
|
- spec/opensearch/api/actions/indices/exists_template_spec.rb
|
608
|
-
- spec/opensearch/api/actions/indices/exists_type_spec.rb
|
609
592
|
- spec/opensearch/api/actions/indices/field_usage_stats_spec.rb
|
610
593
|
- spec/opensearch/api/actions/indices/flush_spec.rb
|
611
|
-
- spec/opensearch/api/actions/indices/flush_synced_spec.rb
|
612
594
|
- spec/opensearch/api/actions/indices/forcemerge_spec.rb
|
613
595
|
- spec/opensearch/api/actions/indices/get_alias_spec.rb
|
614
596
|
- spec/opensearch/api/actions/indices/get_field_mapping_spec.rb
|
@@ -778,10 +760,8 @@ test_files:
|
|
778
760
|
- spec/opensearch/api/actions/indices/exists_alias_spec.rb
|
779
761
|
- spec/opensearch/api/actions/indices/exists_spec.rb
|
780
762
|
- spec/opensearch/api/actions/indices/exists_template_spec.rb
|
781
|
-
- spec/opensearch/api/actions/indices/exists_type_spec.rb
|
782
763
|
- spec/opensearch/api/actions/indices/field_usage_stats_spec.rb
|
783
764
|
- spec/opensearch/api/actions/indices/flush_spec.rb
|
784
|
-
- spec/opensearch/api/actions/indices/flush_synced_spec.rb
|
785
765
|
- spec/opensearch/api/actions/indices/forcemerge_spec.rb
|
786
766
|
- spec/opensearch/api/actions/indices/get_alias_spec.rb
|
787
767
|
- spec/opensearch/api/actions/indices/get_field_mapping_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|