Hello community,
here is the log from the commit of package python-elasticsearch for
openSUSE:Factory checked in at 2019-09-17 13:36:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-elasticsearch (Old)
and /work/SRC/openSUSE:Factory/.python-elasticsearch.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-elasticsearch"
Tue Sep 17 13:36:17 2019 rev:7 rq:730628 version:7.0.4
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-elasticsearch/python-elasticsearch.changes
2019-06-13 22:29:20.496459337 +0200
+++
/work/SRC/openSUSE:Factory/.python-elasticsearch.new.7948/python-elasticsearch.changes
2019-09-17 13:36:18.777853345 +0200
@@ -1,0 +2,8 @@
+Fri Sep 13 08:03:22 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 7.0.4:
+ * remove sleep in retries
+ * pass scroll_id through body in scroll
+ * add user-agent
+
+-------------------------------------------------------------------
Old:
----
7.0.2.tar.gz
New:
----
7.0.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-elasticsearch.spec ++++++
--- /var/tmp/diff_new_pack.toIC3k/_old 2019-09-17 13:36:19.277853265 +0200
+++ /var/tmp/diff_new_pack.toIC3k/_new 2019-09-17 13:36:19.277853265 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without test
Name: python-elasticsearch
-Version: 7.0.2
+Version: 7.0.4
Release: 0
Summary: Python client for Elasticsearch
License: Apache-2.0
++++++ 7.0.2.tar.gz -> 7.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/Changelog.rst
new/elasticsearch-py-7.0.4/Changelog.rst
--- old/elasticsearch-py-7.0.2/Changelog.rst 2019-05-28 19:33:06.000000000
+0200
+++ new/elasticsearch-py-7.0.4/Changelog.rst 2019-08-22 18:10:02.000000000
+0200
@@ -5,6 +5,16 @@
7.1.0 (dev)
-----------
+7.0.4 (2019-08-22)
+-----------
+ * Fix wheel distribution
+
+7.0.3 (2019-08-21)
+-----------
+ * remove sleep in retries
+ * pass ``scroll_id`` through body in ``scroll``
+ * add ``user-agent``
+
7.0.2 (2019-05-29)
-----------
* Add connection parameter for Elastic Cloud cloud_id.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/docs/helpers.rst
new/elasticsearch-py-7.0.4/docs/helpers.rst
--- old/elasticsearch-py-7.0.2/docs/helpers.rst 2019-05-28 19:33:06.000000000
+0200
+++ new/elasticsearch-py-7.0.4/docs/helpers.rst 2019-08-22 18:10:02.000000000
+0200
@@ -93,6 +93,23 @@
For a more complete and complex example please take a look at
https://github.com/elastic/elasticsearch-py/blob/master/example/load.py#L76-L130
+The :meth:`~elasticsearch.Elasticsearch.parallel_bulk` api is a wrapper around
the :meth:`~elasticsearch.Elasticsearch.bulk` api to provide threading.
:meth:`~elasticsearch.Elasticsearch.parallel_bulk` returns a generator which
must be consumed to produce results.
+
+To see the results use:
+
+.. code:: python
+
+ for success, info in parallel_bulk(...):
+ if not success:
+ print('A document failed:', info)
+
+If you don't care about the results, you can use deque from collections:
+
+.. code:: python
+
+ from collections import deque
+ deque(parallel_bulk(...), maxlen=0)
+
.. note::
When reading raw json strings from a file, you can also pass them in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/docs/index.rst
new/elasticsearch-py-7.0.4/docs/index.rst
--- old/elasticsearch-py-7.0.2/docs/index.rst 2019-05-28 19:33:06.000000000
+0200
+++ new/elasticsearch-py-7.0.4/docs/index.rst 2019-08-22 18:10:02.000000000
+0200
@@ -17,6 +17,9 @@
The library is compatible with all Elasticsearch versions since ``0.90.x`` but
you
**have to use a matching major version**:
+For **Elasticsearch 7.0** and later, use the major version 7 (``7.x.y``) of the
+library.
+
For **Elasticsearch 6.0** and later, use the major version 6 (``6.x.y``) of the
library.
@@ -29,6 +32,9 @@
The recommended way to set your requirements in your `setup.py` or
`requirements.txt` is::
+ # Elasticsearch 7.x
+ elasticsearch>=7.0.0,<8.0.0
+
# Elasticsearch 6.x
elasticsearch>=6.0.0,<7.0.0
@@ -39,7 +45,7 @@
elasticsearch>=2.0.0,<3.0.0
If you have a need to have multiple versions installed at the same time older
-versions are also released as ``elasticsearch2`` and ``elasticsearch5``.
+versions are also released as ``elasticsearch2``, ``elasticsearch5`` and
``elasticsearch6``.
Installation
------------
@@ -63,10 +69,10 @@
'text': 'Elasticsearch: cool. bonsai cool.',
'timestamp': datetime.now(),
}
- res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
+ res = es.index(index="test-index", id=1, body=doc)
print(res['result'])
- res = es.get(index="test-index", doc_type='tweet', id=1)
+ res = es.get(index="test-index", id=1)
print(res['_source'])
es.indices.refresh(index="test-index")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/elasticsearch/__init__.py
new/elasticsearch-py-7.0.4/elasticsearch/__init__.py
--- old/elasticsearch-py-7.0.2/elasticsearch/__init__.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/__init__.py 2019-08-22
18:10:02.000000000 +0200
@@ -1,7 +1,7 @@
# flake8: noqa
from __future__ import absolute_import
-VERSION = (7, 0, 2)
+VERSION = (7, 0, 4)
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/elasticsearch/client/__init__.py
new/elasticsearch-py-7.0.4/elasticsearch/client/__init__.py
--- old/elasticsearch-py-7.0.2/elasticsearch/client/__init__.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/client/__init__.py 2019-08-22
18:10:02.000000000 +0200
@@ -1296,8 +1296,8 @@
"GET", _make_path(index, doc_type, id, "_explain"), params=params,
body=body
)
- @query_params("scroll", "rest_total_hits_as_int", "scroll_id")
- def scroll(self, body=None, params=None):
+ @query_params("scroll", "rest_total_hits_as_int")
+ def scroll(self, body=None, scroll_id=None, params=None):
"""
Scroll a search request created by specifying the scroll parameter.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_
@@ -1310,6 +1310,12 @@
in the response. This param is added version 6.x to handle mixed
cluster queries where nodes
are in multiple versions (7.0 and 6.latest)
"""
+ if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
+ raise ValueError("You need to supply scroll_id or body.")
+ elif scroll_id and not body:
+ body = {"scroll_id": scroll_id}
+ elif scroll_id:
+ params["scroll_id"] = scroll_id
return self.transport.perform_request(
"GET", "/_search/scroll", params=params, body=body
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/elasticsearch/connection/base.py
new/elasticsearch-py-7.0.4/elasticsearch/connection/base.py
--- old/elasticsearch-py-7.0.2/elasticsearch/connection/base.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/connection/base.py 2019-08-22
18:10:02.000000000 +0200
@@ -1,11 +1,14 @@
import logging
+from platform import python_version
+
try:
import simplejson as json
except ImportError:
import json
from ..exceptions import TransportError, HTTP_EXCEPTIONS
+from .. import __versionstr__
logger = logging.getLogger("elasticsearch")
@@ -177,3 +180,6 @@
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(
status_code, error_message, additional_info
)
+
+ def _get_default_user_agent(self):
+ return "elasticsearch-py/%s (Python %s)" % (__versionstr__,
python_version())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/elasticsearch/connection/http_requests.py
new/elasticsearch-py-7.0.4/elasticsearch/connection/http_requests.py
--- old/elasticsearch-py-7.0.2/elasticsearch/connection/http_requests.py
2019-05-28 19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/connection/http_requests.py
2019-08-22 18:10:02.000000000 +0200
@@ -73,6 +73,7 @@
self.session = requests.Session()
self.session.headers = headers or {}
self.session.headers.setdefault("content-type", "application/json")
+ self.session.headers.setdefault("user-agent",
self._get_default_user_agent())
if http_auth is not None:
if isinstance(http_auth, (tuple, list)):
http_auth = tuple(http_auth)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/elasticsearch/connection/http_urllib3.py
new/elasticsearch-py-7.0.4/elasticsearch/connection/http_urllib3.py
--- old/elasticsearch-py-7.0.2/elasticsearch/connection/http_urllib3.py
2019-05-28 19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/connection/http_urllib3.py
2019-08-22 18:10:02.000000000 +0200
@@ -127,6 +127,7 @@
self.headers.update({"content-encoding": "gzip"})
self.headers.setdefault("content-type", "application/json")
+ self.headers.setdefault("user-agent", self._get_default_user_agent())
pool_class = urllib3.HTTPConnectionPool
kw = {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/elasticsearch/helpers/actions.py
new/elasticsearch-py-7.0.4/elasticsearch/helpers/actions.py
--- old/elasticsearch-py-7.0.2/elasticsearch/helpers/actions.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/helpers/actions.py 2019-08-22
18:10:02.000000000 +0200
@@ -454,8 +454,9 @@
"Scroll request has only succeeded on %d shards out of
%d."
% (resp["_shards"]["successful"],
resp["_shards"]["total"]),
)
- scroll_kwargs.update({"scroll_id": scroll_id, "scroll": scroll})
- resp = client.scroll(**scroll_kwargs)
+ resp = client.scroll(
+ body={"scroll_id": scroll_id, "scroll": scroll},
**scroll_kwargs
+ )
scroll_id = resp.get("_scroll_id")
finally:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/elasticsearch/transport.py
new/elasticsearch-py-7.0.4/elasticsearch/transport.py
--- old/elasticsearch-py-7.0.2/elasticsearch/transport.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/elasticsearch/transport.py 2019-08-22
18:10:02.000000000 +0200
@@ -1,9 +1,11 @@
import time
from itertools import chain
+from platform import python_version
from .connection import Urllib3HttpConnection
from .connection_pool import ConnectionPool, DummyConnectionPool
from .serializer import JSONSerializer, Deserializer, DEFAULT_SERIALIZERS
+from . import __versionstr__
from .exceptions import (
ConnectionError,
TransportError,
@@ -334,15 +336,10 @@
ignore = params.pop("ignore", ())
if isinstance(ignore, int):
ignore = (ignore,)
-
for attempt in range(self.max_retries + 1):
connection = self.get_connection()
try:
- # add a delay before attempting the next retry
- # 0, 1, 3, 7, etc...
- delay = 2 ** attempt - 1
- time.sleep(delay)
status, headers_response, data = connection.perform_request(
method,
url,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/elasticsearch-py-7.0.2/setup.py
new/elasticsearch-py-7.0.4/setup.py
--- old/elasticsearch-py-7.0.2/setup.py 2019-05-28 19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/setup.py 2019-08-22 18:10:02.000000000 +0200
@@ -3,7 +3,7 @@
from setuptools import setup, find_packages
import sys
-VERSION = (7, 0, 2)
+VERSION = (7, 0, 4)
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/test_elasticsearch/run_tests.py
new/elasticsearch-py-7.0.4/test_elasticsearch/run_tests.py
--- old/elasticsearch-py-7.0.2/test_elasticsearch/run_tests.py 2019-05-28
19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/test_elasticsearch/run_tests.py 2019-08-22
18:10:02.000000000 +0200
@@ -54,7 +54,7 @@
shell=True,
)
# reset to the version fron info()
- subprocess.check_call("cd %s && git pull" % repo_path, shell=True)
+ subprocess.check_call("cd %s && git fetch" % repo_path, shell=True)
subprocess.check_call("cd %s && git reset --hard %s" % (repo_path, sha),
shell=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/test_elasticsearch/test_connection.py
new/elasticsearch-py-7.0.4/test_elasticsearch/test_connection.py
--- old/elasticsearch-py-7.0.2/test_elasticsearch/test_connection.py
2019-05-28 19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/test_elasticsearch/test_connection.py
2019-08-22 18:10:02.000000000 +0200
@@ -5,6 +5,7 @@
import urllib3
import warnings
from requests.auth import AuthBase
+from platform import python_version
from elasticsearch.exceptions import (
TransportError,
@@ -14,9 +15,9 @@
)
from elasticsearch.connection import RequestsHttpConnection,
Urllib3HttpConnection
from elasticsearch.exceptions import ImproperlyConfigured
+from elasticsearch import __versionstr__
from .test_cases import TestCase, SkipTest
-
class TestUrllib3Connection(TestCase):
def test_ssl_context(self):
try:
@@ -48,6 +49,10 @@
self.assertTrue(con.http_compress)
self.assertEquals(con.headers["content-encoding"], "gzip")
+ def test_default_user_agent(self):
+ con = Urllib3HttpConnection()
+ self.assertEquals(con._get_default_user_agent(), "elasticsearch-py/%s
(Python %s)" % (__versionstr__, python_version()))
+
def test_timeout_set(self):
con = Urllib3HttpConnection(timeout=42)
self.assertEquals(42, con.timeout)
@@ -55,7 +60,11 @@
def test_keep_alive_is_on_by_default(self):
con = Urllib3HttpConnection()
self.assertEquals(
- {"connection": "keep-alive", "content-type": "application/json"},
+ {
+ "connection": "keep-alive",
+ "content-type": "application/json",
+ "user-agent": con._get_default_user_agent(),
+ },
con.headers,
)
@@ -66,6 +75,7 @@
"authorization": "Basic dXNlcm5hbWU6c2VjcmV0",
"connection": "keep-alive",
"content-type": "application/json",
+ "user-agent": con._get_default_user_agent(),
},
con.headers,
)
@@ -77,6 +87,7 @@
"authorization": "Basic dXNlcm5hbWU6c2VjcmV0",
"content-type": "application/json",
"connection": "keep-alive",
+ "user-agent": con._get_default_user_agent(),
},
con.headers,
)
@@ -88,6 +99,7 @@
"authorization": "Basic dXNlcm5hbWU6c2VjcmV0",
"content-type": "application/json",
"connection": "keep-alive",
+ "user-agent": con._get_default_user_agent(),
},
con.headers,
)
@@ -213,6 +225,21 @@
self.assertEquals(req.headers["h2"], "v2p")
self.assertEquals(req.headers["h3"], "v3")
+ def test_default_headers(self):
+ con = self._get_mock_connection()
+ req = self._get_request(con, "GET", "/")
+ self.assertEquals(req.headers["content-type"], "application/json")
+ self.assertEquals(req.headers["user-agent"],
con._get_default_user_agent())
+
+ def test_custom_headers(self):
+ con = self._get_mock_connection()
+ req = self._get_request(con, "GET", "/", headers={
+ "content-type": "application/x-ndjson",
+ "user-agent": "custom-agent/1.2.3",
+ })
+ self.assertEquals(req.headers["content-type"], "application/x-ndjson")
+ self.assertEquals(req.headers["user-agent"], "custom-agent/1.2.3")
+
def test_http_auth(self):
con = RequestsHttpConnection(http_auth="username:secret")
self.assertEquals(("username", "secret"), con.session.auth)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/elasticsearch-py-7.0.2/test_elasticsearch/test_transport.py
new/elasticsearch-py-7.0.4/test_elasticsearch/test_transport.py
--- old/elasticsearch-py-7.0.2/test_elasticsearch/test_transport.py
2019-05-28 19:33:06.000000000 +0200
+++ new/elasticsearch-py-7.0.4/test_elasticsearch/test_transport.py
2019-08-22 18:10:02.000000000 +0200
@@ -82,7 +82,22 @@
self.assertEquals(1, len(t.get_connection().calls))
self.assertEquals(("GET", "/", {}, None),
t.get_connection().calls[0][0])
self.assertEquals(
- {"timeout": 42, "ignore": (), "headers": None},
+ {
+ "timeout": 42,
+ "ignore": (),
+ "headers": None,
+ },
+ t.get_connection().calls[0][1],
+ )
+
+ def test_request_with_custom_user_agent_header(self):
+ t = Transport([{}], connection_class=DummyConnection)
+
+ t.perform_request("GET", "/", headers={"user-agent":
"my-custom-value/1.2.3"})
+ self.assertEquals(1, len(t.get_connection().calls))
+ self.assertEquals(
+ {"timeout": None, "ignore": (), "headers": {"user-agent":
"my-custom-value/1.2.3"}
+ },
t.get_connection().calls[0][1],
)