Remove opaque_id from the client constructor
This commit is contained in:
committed by
GitHub
parent
c38918dafc
commit
7b6a12f2e5
+1
-1
@@ -1,5 +1,5 @@
|
||||
ELASTICSEARCH_VERSION:
|
||||
- 7.x-SNAPSHOT
|
||||
- 7.6-SNAPSHOT
|
||||
|
||||
TEST_SUITE:
|
||||
- oss
|
||||
|
||||
+4
-5
@@ -70,13 +70,12 @@ or to help with `identifying running tasks <https://www.elastic.co/guide/en/elas
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import elasticsearch
|
||||
from elasticsearch import Elasticsearch
|
||||
|
||||
# You can add to the client to apply to all requests
|
||||
client = elasticsearch.Elasticsearch(opaque_id="app17@dc06.eu_user1234")
|
||||
client = Elasticsearch()
|
||||
|
||||
# Or you can apply per-request for more granularity.
|
||||
resp = client.get(index="test", id="1", opaque_id="app17@dc06.eu_user1234")
|
||||
# You can apply X-Opaque-Id in any API request via 'opaque_id':
|
||||
resp = client.get(index="test", id="1", opaque_id="request-1")
|
||||
|
||||
|
||||
.. py:module:: elasticsearch
|
||||
|
||||
@@ -52,7 +52,6 @@ class Connection(object):
|
||||
http_compress=None,
|
||||
cloud_id=None,
|
||||
api_key=None,
|
||||
opaque_id=None,
|
||||
**kwargs
|
||||
):
|
||||
|
||||
@@ -89,8 +88,6 @@ class Connection(object):
|
||||
headers = headers or {}
|
||||
for key in headers:
|
||||
self.headers[key.lower()] = headers[key]
|
||||
if opaque_id:
|
||||
self.headers["x-opaque-id"] = opaque_id
|
||||
|
||||
self.headers.setdefault("content-type", "application/json")
|
||||
self.headers.setdefault("user-agent", self._get_default_user_agent())
|
||||
|
||||
@@ -119,10 +119,6 @@ class TestUrllib3Connection(TestCase):
|
||||
self.assertIsInstance(con.pool.conn_kw["ssl_context"], ssl.SSLContext)
|
||||
self.assertTrue(con.use_ssl)
|
||||
|
||||
def test_opaque_id(self):
|
||||
con = Urllib3HttpConnection(opaque_id="app-1")
|
||||
self.assertEqual(con.headers["x-opaque-id"], "app-1")
|
||||
|
||||
def test_http_cloud_id(self):
|
||||
con = Urllib3HttpConnection(
|
||||
cloud_id="cluster:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyQ0ZmE4ODIxZTc1NjM0MDMyYmVkMWNmMjIxMTBlMmY5NyQ0ZmE4ODIxZTc1NjM0MDMyYmVkMWNmMjIxMTBlMmY5Ng=="
|
||||
@@ -398,10 +394,6 @@ class TestRequestsConnection(TestCase):
|
||||
con = RequestsHttpConnection(timeout=42)
|
||||
self.assertEquals(42, con.timeout)
|
||||
|
||||
def test_opaque_id(self):
|
||||
con = RequestsHttpConnection(opaque_id="app-1")
|
||||
self.assertEqual(con.headers["x-opaque-id"], "app-1")
|
||||
|
||||
def test_http_cloud_id(self):
|
||||
con = RequestsHttpConnection(
|
||||
cloud_id="cluster:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyQ0ZmE4ODIxZTc1NjM0MDMyYmVkMWNmMjIxMTBlMmY5NyQ0ZmE4ODIxZTc1NjM0MDMyYmVkMWNmMjIxMTBlMmY5Ng=="
|
||||
|
||||
Reference in New Issue
Block a user