From 01a0057e00d1d0daa9077a4bc7f6a758052f2a47 Mon Sep 17 00:00:00 2001 From: Matt Crees Date: Tue, 7 Nov 2023 14:20:27 +0000 Subject: [PATCH] Remove mapping name from bulk API URL (cherry picked from commit e77911550281bcde19976df6501ad126dd12b411) --- cloudkitty/storage/v2/elasticsearch/client.py | 4 ++-- cloudkitty/tests/storage/v2/elasticsearch/test_client.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloudkitty/storage/v2/elasticsearch/client.py b/cloudkitty/storage/v2/elasticsearch/client.py index 98418e3f..8f681b70 100644 --- a/cloudkitty/storage/v2/elasticsearch/client.py +++ b/cloudkitty/storage/v2/elasticsearch/client.py @@ -225,7 +225,7 @@ def bulk_with_instruction(self, instruction, terms): """Does a POST request against ES's bulk API The POST request will be done against - `///_bulk` + `//_bulk` The instruction will be appended before each term. For example, bulk_with_instruction('instr', ['one', 'two']) will produce:: @@ -246,7 +246,7 @@ def bulk_with_instruction(self, instruction, terms): *[(instruction, json.dumps(term)) for term in terms] )) + '\n' url = '/'.join( - (self._url, self._index_name, self._mapping_name, '_bulk')) + (self._url, self._index_name, '_bulk')) return self._req(self._sess.post, url, data, None, deserialize=False) def bulk_index(self, terms): diff --git a/cloudkitty/tests/storage/v2/elasticsearch/test_client.py b/cloudkitty/tests/storage/v2/elasticsearch/test_client.py index 89853e67..460fa5e3 100644 --- a/cloudkitty/tests/storage/v2/elasticsearch/test_client.py +++ b/cloudkitty/tests/storage/v2/elasticsearch/test_client.py @@ -259,7 +259,7 @@ def test_bulk_with_instruction(self): self.client.bulk_with_instruction(instruction, terms) rmock.assert_called_once_with( self.client._sess.post, - 'http://elasticsearch:9200/index_name/test_mapping/_bulk', + 'http://elasticsearch:9200/index_name/_bulk', expected_data, None, deserialize=False) def test_bulk_index(self):