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.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +28 -0
  5. data/Gemfile +2 -2
  6. data/README.md +12 -182
  7. data/Rakefile +5 -5
  8. data/USER_GUIDE.md +155 -0
  9. data/lib/opensearch/api/actions/benchmark.rb +0 -1
  10. data/lib/opensearch/api/actions/bulk.rb +1 -7
  11. data/lib/opensearch/api/actions/cat/all_pit_segments.rb +46 -0
  12. data/lib/opensearch/api/actions/cat/allocation.rb +4 -2
  13. data/lib/opensearch/api/actions/cat/cluster_manager.rb +54 -0
  14. data/lib/opensearch/api/actions/cat/indices.rb +4 -2
  15. data/lib/opensearch/api/actions/cat/master.rb +3 -1
  16. data/lib/opensearch/api/actions/cat/nodeattrs.rb +4 -2
  17. data/lib/opensearch/api/actions/cat/nodes.rb +4 -2
  18. data/lib/opensearch/api/actions/cat/pending_tasks.rb +4 -2
  19. data/lib/opensearch/api/actions/cat/pit_segments.rb +49 -0
  20. data/lib/opensearch/api/actions/cat/plugins.rb +4 -2
  21. data/lib/opensearch/api/actions/cat/repositories.rb +4 -2
  22. data/lib/opensearch/api/actions/cat/shards.rb +4 -2
  23. data/lib/opensearch/api/actions/cat/snapshots.rb +3 -1
  24. data/lib/opensearch/api/actions/cat/templates.rb +4 -2
  25. data/lib/opensearch/api/actions/cat/thread_pool.rb +4 -2
  26. data/lib/opensearch/api/actions/cluster/delete_component_template.rb +4 -2
  27. data/lib/opensearch/api/actions/cluster/exists_component_template.rb +4 -2
  28. data/lib/opensearch/api/actions/cluster/get_component_template.rb +4 -2
  29. data/lib/opensearch/api/actions/cluster/get_settings.rb +3 -1
  30. data/lib/opensearch/api/actions/cluster/health.rb +4 -2
  31. data/lib/opensearch/api/actions/cluster/pending_tasks.rb +5 -3
  32. data/lib/opensearch/api/actions/cluster/put_component_template.rb +4 -2
  33. data/lib/opensearch/api/actions/cluster/put_settings.rb +3 -1
  34. data/lib/opensearch/api/actions/cluster/reroute.rb +4 -2
  35. data/lib/opensearch/api/actions/cluster/state.rb +4 -2
  36. data/lib/opensearch/api/actions/count.rb +1 -6
  37. data/lib/opensearch/api/actions/create.rb +0 -1
  38. data/lib/opensearch/api/actions/create_pit.rb +45 -0
  39. data/lib/opensearch/api/actions/dangling_indices/delete_dangling_index.rb +4 -2
  40. data/lib/opensearch/api/actions/dangling_indices/import_dangling_index.rb +4 -2
  41. data/lib/opensearch/api/actions/delete.rb +1 -8
  42. data/lib/opensearch/api/actions/delete_all_pits.rb +26 -0
  43. data/lib/opensearch/api/actions/delete_by_query.rb +1 -8
  44. data/lib/opensearch/api/actions/delete_pit.rb +30 -0
  45. data/lib/opensearch/api/actions/delete_script.rb +4 -2
  46. data/lib/opensearch/api/actions/exists.rb +1 -8
  47. data/lib/opensearch/api/actions/exists_source.rb +1 -8
  48. data/lib/opensearch/api/actions/explain.rb +1 -8
  49. data/lib/opensearch/api/actions/features/get_features.rb +4 -2
  50. data/lib/opensearch/api/actions/get.rb +1 -8
  51. data/lib/opensearch/api/actions/get_all_pits.rb +26 -0
  52. data/lib/opensearch/api/actions/get_script.rb +4 -2
  53. data/lib/opensearch/api/actions/get_source.rb +1 -8
  54. data/lib/opensearch/api/actions/index.rb +1 -8
  55. data/lib/opensearch/api/actions/indices/add_block.rb +3 -1
  56. data/lib/opensearch/api/actions/indices/clone.rb +3 -1
  57. data/lib/opensearch/api/actions/indices/close.rb +3 -1
  58. data/lib/opensearch/api/actions/indices/create.rb +4 -4
  59. data/lib/opensearch/api/actions/indices/delete.rb +3 -1
  60. data/lib/opensearch/api/actions/indices/delete_alias.rb +4 -2
  61. data/lib/opensearch/api/actions/indices/delete_index_template.rb +4 -2
  62. data/lib/opensearch/api/actions/indices/delete_template.rb +4 -2
  63. data/lib/opensearch/api/actions/indices/exists_index_template.rb +4 -2
  64. data/lib/opensearch/api/actions/indices/exists_template.rb +4 -2
  65. data/lib/opensearch/api/actions/indices/get.rb +4 -4
  66. data/lib/opensearch/api/actions/indices/get_field_mapping.rb +1 -10
  67. data/lib/opensearch/api/actions/indices/get_index_template.rb +4 -2
  68. data/lib/opensearch/api/actions/indices/get_mapping.rb +5 -12
  69. data/lib/opensearch/api/actions/indices/get_settings.rb +3 -1
  70. data/lib/opensearch/api/actions/indices/get_template.rb +4 -4
  71. data/lib/opensearch/api/actions/indices/open.rb +3 -1
  72. data/lib/opensearch/api/actions/indices/put_alias.rb +4 -2
  73. data/lib/opensearch/api/actions/indices/put_index_template.rb +4 -2
  74. data/lib/opensearch/api/actions/indices/put_mapping.rb +4 -13
  75. data/lib/opensearch/api/actions/indices/put_settings.rb +3 -1
  76. data/lib/opensearch/api/actions/indices/put_template.rb +4 -4
  77. data/lib/opensearch/api/actions/indices/rollover.rb +3 -3
  78. data/lib/opensearch/api/actions/indices/shrink.rb +3 -1
  79. data/lib/opensearch/api/actions/indices/simulate_index_template.rb +4 -2
  80. data/lib/opensearch/api/actions/indices/simulate_template.rb +4 -2
  81. data/lib/opensearch/api/actions/indices/split.rb +3 -1
  82. data/lib/opensearch/api/actions/indices/update_aliases.rb +4 -2
  83. data/lib/opensearch/api/actions/indices/validate_query.rb +1 -6
  84. data/lib/opensearch/api/actions/ingest/delete_pipeline.rb +3 -1
  85. data/lib/opensearch/api/actions/ingest/get_pipeline.rb +4 -2
  86. data/lib/opensearch/api/actions/ingest/put_pipeline.rb +3 -1
  87. data/lib/opensearch/api/actions/mget.rb +2 -7
  88. data/lib/opensearch/api/actions/msearch.rb +1 -6
  89. data/lib/opensearch/api/actions/msearch_template.rb +1 -6
  90. data/lib/opensearch/api/actions/mtermvectors.rb +1 -6
  91. data/lib/opensearch/api/actions/put_script.rb +3 -1
  92. data/lib/opensearch/api/actions/search.rb +1 -7
  93. data/lib/opensearch/api/actions/search_shards.rb +1 -1
  94. data/lib/opensearch/api/actions/search_template.rb +1 -6
  95. data/lib/opensearch/api/actions/snapshot/cleanup_repository.rb +3 -1
  96. data/lib/opensearch/api/actions/snapshot/clone.rb +4 -2
  97. data/lib/opensearch/api/actions/snapshot/create.rb +3 -1
  98. data/lib/opensearch/api/actions/snapshot/create_repository.rb +3 -1
  99. data/lib/opensearch/api/actions/snapshot/delete.rb +4 -2
  100. data/lib/opensearch/api/actions/snapshot/delete_repository.rb +3 -1
  101. data/lib/opensearch/api/actions/snapshot/get.rb +3 -1
  102. data/lib/opensearch/api/actions/snapshot/get_features.rb +4 -2
  103. data/lib/opensearch/api/actions/snapshot/get_repository.rb +3 -2
  104. data/lib/opensearch/api/actions/snapshot/restore.rb +3 -1
  105. data/lib/opensearch/api/actions/snapshot/status.rb +3 -1
  106. data/lib/opensearch/api/actions/snapshot/verify_repository.rb +3 -1
  107. data/lib/opensearch/api/actions/termvectors.rb +1 -8
  108. data/lib/opensearch/api/actions/update.rb +1 -8
  109. data/lib/opensearch/api/actions/update_by_query.rb +1 -8
  110. data/lib/opensearch/api/utils.rb +5 -5
  111. data/lib/opensearch/api/version.rb +1 -1
  112. data/lib/opensearch/api.rb +1 -1
  113. data/opensearch-api.gemspec +2 -3
  114. data/spec/opensearch/api/actions/bulk_spec.rb +10 -21
  115. data/spec/opensearch/api/actions/cat/all_pit_segments_spec.rb +36 -0
  116. data/spec/opensearch/api/actions/cat/allocation_spec.rb +6 -7
  117. data/spec/opensearch/api/actions/cat/cluster_manager_spec.rb +26 -0
  118. data/spec/opensearch/api/actions/cat/pit_segments_spec.rb +43 -0
  119. data/spec/opensearch/api/actions/count_spec.rb +3 -3
  120. data/spec/opensearch/api/actions/create_document_spec.rb +8 -8
  121. data/spec/opensearch/api/actions/create_pit_spec.rb +58 -0
  122. data/spec/opensearch/api/actions/delete_all_pits_spec.rb +35 -0
  123. data/spec/opensearch/api/actions/delete_by_query_spec.rb +0 -17
  124. data/spec/opensearch/api/actions/delete_document_spec.rb +10 -10
  125. data/spec/opensearch/api/actions/delete_pit_spec.rb +41 -0
  126. data/spec/opensearch/api/actions/exists_document_spec.rb +10 -10
  127. data/spec/opensearch/api/actions/explain_document_spec.rb +8 -8
  128. data/spec/opensearch/api/actions/get_all_pits_spec.rb +35 -0
  129. data/spec/opensearch/api/actions/get_document_source_spec.rb +6 -6
  130. data/spec/opensearch/api/actions/get_document_spec.rb +8 -8
  131. data/spec/opensearch/api/actions/get_script_spec.rb +2 -2
  132. data/spec/opensearch/api/actions/hashie_spec.rb +0 -2
  133. data/spec/opensearch/api/actions/index_document_spec.rb +12 -12
  134. data/spec/opensearch/api/actions/indices/clone_spec.rb +2 -2
  135. data/spec/opensearch/api/actions/indices/get_field_mapping_spec.rb +0 -11
  136. data/spec/opensearch/api/actions/indices/get_mapping_spec.rb +5 -16
  137. data/spec/opensearch/api/actions/indices/put_mapping_spec.rb +8 -21
  138. data/spec/opensearch/api/actions/indices/validate_query_spec.rb +0 -10
  139. data/spec/opensearch/api/actions/mget_spec.rb +2 -17
  140. data/spec/opensearch/api/actions/mtermvectors_spec.rb +3 -3
  141. data/spec/opensearch/api/actions/search_spec.rb +5 -16
  142. data/spec/opensearch/api/actions/termvectors_spec.rb +5 -5
  143. data/spec/opensearch/api/actions/update_document_spec.rb +11 -11
  144. data/spec/opensearch/api/utils_spec.rb +7 -14
  145. data.tar.gz.sig +0 -0
  146. metadata +40 -43
  147. metadata.gz.sig +0 -0
  148. data/lib/opensearch/api/actions/close_point_in_time.rb +0 -50
  149. data/lib/opensearch/api/actions/indices/exists_type.rb +0 -79
  150. data/lib/opensearch/api/actions/indices/flush_synced.rb +0 -79
  151. data/lib/opensearch/api/actions/open_point_in_time.rb +0 -72
  152. data/spec/opensearch/api/actions/close_point_in_time_spec.rb +0 -43
  153. data/spec/opensearch/api/actions/indices/exists_type_spec.rb +0 -117
  154. data/spec/opensearch/api/actions/indices/flush_synced_spec.rb +0 -99
  155. data/spec/opensearch/api/actions/open_point_in_time_spec.rb +0 -53
@@ -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 an index and type are specified' do
60
+ context 'when multiple indices are specified' do
61
61
 
62
62
  let(:url) do
63
- 'foo/_mapping/bar'
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', type: 'bar')).to eq({})
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/bar%2Fbam'
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', type: 'bar/bam')).to eq({})
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/bar/_mappings'
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', type: 'bar', body: {})).to eq({})
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', type: 'bar')
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', type: 'bar', body: { filter: 'foo' })).to eq({})
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/bam/_mappings'
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'], type: 'bam', body: {})).to eq({})
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/bar%2Fbam/_mappings'
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', type: 'bar/bam', body: {})).to eq({})
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/bar%2Fbam/_mget'
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', type: 'bar/bam', body: { :ids => [ '1', '2'] })).to eq({})
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/my-type/_mtermvectors',
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', type: 'my-type', body: { ids: [1, 2, 3] })).to eq({})
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', type: 'my-type', ids: [1, 2, 3])).to eq({})
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
- '_all/foo/_search'
50
+ '_search'
51
51
  end
52
52
 
53
53
  it 'has a default value for index' do
54
- expect(client_double.search(type: 'foo'))
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 and type are specified' do
83
+ context 'when an index is specified' do
84
84
 
85
85
  let(:url) do
86
- 'foo/bar/_search'
86
+ 'foo/_search'
87
87
  end
88
88
 
89
89
  it 'performs the request' do
90
- expect(client_double.search(index: 'foo', type: 'bar'))
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/bar/123/_termvectors'
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(type: 'bar', id: '1')
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', type: 'bar', id: '123', body: {})).to eq({})
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/bar/123/_termvector'
68
+ 'foo/_termvector/123'
69
69
  end
70
70
 
71
71
  it 'performs the request' do
72
- expect(client_double.termvector(index: 'foo', type: 'bar', id: '123', body: {})).to eq({})
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/bar/1/_update'
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(type: 'bar', id: '1')
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', type: 'bar')
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', type: 'bar', id: '1', body: { doc: {} })).to eq({})
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/bar/1/_update'
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', type: 'bar', id: '1', body: {}))
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', type: 'bar', id: '1', body: { doc: {} }, qwertypoiuy: 'asdflkjhg')
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/bar%2Fbam/1/_update'
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', type: 'bar/bam', id: '1', body: {}))
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', type: 'bar', id: 'XXX', body: {})
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', type: 'bar', id: 'XXX', body: {}, ignore: 404)).to eq(false)
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 'users CGI.escape by default' do
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', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } },
120
- { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } },
121
- { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } }
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","_type":"mytype","_id":"1"}}
120
+ {"index":{"_index":"myindexA","_id":"1"}}
128
121
  {"title":"Test"}
129
- {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}}
122
+ {"update":{"_index":"myindexB","_id":"2"}}
130
123
  {"doc":{"title":"Update"}}
131
- {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}}
124
+ {"delete":{"_index":"myindexC","_id":"3"}}
132
125
  PAYLOAD
133
126
  end
134
127
 
data.tar.gz.sig CHANGED
Binary file