Skip to content

Commit b101365

Browse files
authored
Merge pull request #63 from stackhpc/2023.1-os-migration-fixes
2023.1 os migration fixes
2 parents eecadb1 + e779115 commit b101365

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

cloudkitty/storage/v2/elasticsearch/client.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,9 @@ def put_mapping(self, mapping):
158158
:rtype: requests.models.Response
159159
"""
160160
url = '/'.join(
161-
(self._url, self._index_name, '_mapping', self._mapping_name))
162-
# NOTE(peschk_l): This is done for compatibility with
163-
# Elasticsearch 6 and 7.
164-
param = {"include_type_name": "true"}
161+
(self._url, self._index_name, self._mapping_name))
165162
return self._req(
166-
self._sess.put, url, json.dumps(mapping), param, deserialize=False)
163+
self._sess.post, url, json.dumps(mapping), {}, deserialize=False)
167164

168165
def get_index(self):
169166
"""Does a GET request against ES's index API.
@@ -228,7 +225,7 @@ def bulk_with_instruction(self, instruction, terms):
228225
"""Does a POST request against ES's bulk API
229226
230227
The POST request will be done against
231-
`/<index_name>/<mapping_name>/_bulk`
228+
`/<index_name>/_bulk`
232229
233230
The instruction will be appended before each term. For example,
234231
bulk_with_instruction('instr', ['one', 'two']) will produce::
@@ -249,7 +246,7 @@ def bulk_with_instruction(self, instruction, terms):
249246
*[(instruction, json.dumps(term)) for term in terms]
250247
)) + '\n'
251248
url = '/'.join(
252-
(self._url, self._index_name, self._mapping_name, '_bulk'))
249+
(self._url, self._index_name, '_bulk'))
253250
return self._req(self._sess.post, url, data, None, deserialize=False)
254251

255252
def bulk_index(self, terms):

cloudkitty/tests/storage/v2/elasticsearch/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ def test_put_mapping(self):
186186
with mock.patch.object(self.client, '_req') as rmock:
187187
self.client.put_mapping(mapping)
188188
rmock.assert_called_once_with(
189-
self.client._sess.put,
190-
'http://elasticsearch:9200/index_name/_mapping/test_mapping',
191-
'{"a": "b"}', {'include_type_name': 'true'}, deserialize=False)
189+
self.client._sess.post,
190+
'http://elasticsearch:9200/index_name/test_mapping',
191+
'{"a": "b"}', {}, deserialize=False)
192192

193193
def test_get_index(self):
194194
with mock.patch.object(self.client, '_req') as rmock:
@@ -259,7 +259,7 @@ def test_bulk_with_instruction(self):
259259
self.client.bulk_with_instruction(instruction, terms)
260260
rmock.assert_called_once_with(
261261
self.client._sess.post,
262-
'http://elasticsearch:9200/index_name/test_mapping/_bulk',
262+
'http://elasticsearch:9200/index_name/_bulk',
263263
expected_data, None, deserialize=False)
264264

265265
def test_bulk_index(self):

0 commit comments

Comments
 (0)