Commit Graph
578 Commits
Author SHA1 Message Date
Tyler James HardenandHonza Král cd769b98a5 Additional fixes for UTF-8 surrogate escapes (#629)
* Fixes non UTF-8 surrogateescapes 

Surrogate escapes in Unicode (non UTF-8 encoding) will be properly escaped with backslashes when encountered, versus breaking the transport layer.

* Removes erroneous bytes decode and reraises

Fixes to re-raise exceptions with different reasons
Removes erroneous bytes decode where bytes are desired

* Adds test for surrogate escapes in body

Tests that a surrogate escape sequence is properly escaped
with backslashes to produce valid UTF-8.

* Use proper byte sequence for surrogate

* Use if/else versus pass

* Proper Unicode surrogate escape

Use a Unicode Surrogate that properly escapes in both Python2 and Python3

* Passing test once surrogatepass is used

Updating test to pass once surrogatepass is used

* Use surrogatepass instead of backslashreplace

This replicates behavior between Python 2 and Python 3

* Fixes whitespace

* Simplifies with no exception block

Since `surrogatepass` will only ever explicitly occur when there are surrogate bytes encountered, there is no need to let the error throw and catch it, also uses single-quotes for consistency.

* Fixes Unicode Surrogate Escapes in request logging

This is the same fix as accepted for ElasticSearch requests, except applied to the request logging mechanisms.
2017-08-15 15:41:32 +01:00
Nick LangandGitHub 843ce9ee24 Merge pull request #628 from fxdgear/nick/fix_encode_error
better handling of bytestrings in _escape
2017-08-08 14:13:21 -06:00
Nick Lang a5b228a26d better handling of bytestrings in _escape
Fixes #627
2017-08-08 12:50:04 -06:00
Honza Král 3be98b0a09 first pass for 6.0 compatibility 2017-07-31 19:17:52 -04:00
Honza Král 95cf68a0bc Merge branch 'backoff' 2017-07-24 13:07:55 -04:00
Honza Král 8f73594cac Tests for retry logic in streaming_bulk 2017-07-22 13:40:22 -04:00
Honza Král ba8772a66f When retrying we get deserialized data
This is just a hotfix until a better solution with proper tests come
along
2017-07-22 13:13:53 -04:00
Honza Král 2c0f6d8c04 refactor the helpers a bit for more consistent errors
Now every error (either returned by streaming_bulk or collected by bulk)
contains the original data as well
2017-07-20 13:53:23 -04:00
Honza Král a16679b2cf draft of docs for backoff helper 2017-07-18 18:08:00 -04:00
Honza Král b31b5ddae6 Merged backoff into streaming_bulk 2017-07-18 17:44:43 -04:00
Honza Král 66c380420f Forgot to assign data 2017-07-18 16:20:36 -04:00
Honza Král 957fcad34b Do not serialize the data in bulk_data
This can lead to multiple serializations when retrying with backoff
helper
2017-07-18 16:15:08 -04:00
Honza Král accb19ab90 Action must be a dict, not serialized string 2017-07-18 15:45:43 -04:00
Honza Král f9f4f0c61a have _chunk_actions always return data and actions 2017-07-18 14:18:09 -04:00
Honza Král c8231cad0e Initial implementation of a backoff bulk helper 2017-07-18 14:02:02 -04:00
Victor KandHonza Král 57362aa8c7 Fix elasticsearch.exceptions.__all__ (#621) 2017-07-14 16:50:39 +02:00
Honza Král 620afc667f Set a limit on the internal queue of the parallel_bulk helper
Fixes #547
Solution taken from https://bugs.python.org/msg90067
2017-07-12 23:48:58 +02:00
Tyler James HardenandHonza Král d6fb95353e Fixes non UTF-8 surrogateescapes (#612)
Fixes non UTF-8 surrogateescapes 

Surrogate escapes in Unicode (non UTF-8 encoding) will be properly escaped with backslashes when encountered, versus breaking the transport layer.
Fixes #611
2017-07-11 16:58:46 +02:00
Honza Král 24169821ac add the remote namespace 2017-06-14 19:25:53 +02:00
Honza Král 49af6df631 Added missing APIs 2017-06-14 19:25:11 +02:00
Patryk KrawaczyńskiandHonza Král d67c483e1d 404 - Page Not Found (#594)
Task Management API moved to single page.
2017-05-21 14:06:07 -07:00
Patryk KrawaczyńskiandHonza Král 5de989be07 Fix some spelling errors in docstrings from 2015. (#571) 2017-05-19 14:49:42 -07:00
Honza Král aea9824d53 Version bump for release 2017-05-18 19:11:38 +02:00
Honza Král d336c571b9 [WIP] remove scheme checking 2017-05-15 22:01:54 +02:00
Patryk KrawaczyńskiandHonza Král 6ccc08520c doc_type = type to sample (#572)
elasticsearch.exceptions.RequestError: TransportError(400, 'illegal_argument_exception', 'request [/_cluster/nodes/hotthreads] contains unrecognized parameter: [doc_type]')

https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html
2017-05-10 16:33:38 +02:00
Honza Král 5c658fcfb8 Allow pipeline as a parameter in bulk actions
Fixes #564
2017-04-17 22:12:41 +02:00
Honza Král c318f7fa63 Make sure environment settings are merged in for requests
Fixes #557
2017-04-17 21:59:03 +02:00
Honza Král 618b69ae7a Merge branch 'master' of github.com:elasticsearch/elasticsearch-py 2017-04-13 23:51:25 +02:00
Patrick MézardandHonza Král 7f6d38273e Unquote user:password in hosts (#569)
Before turning them into an authentication header, the user or password
supplied in hosts must be URL decoded.

The RFC https://tools.ietf.org/html/rfc3986 describes userinfo like:

  userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )

and python documentation about urlparse says:

  The components are not broken up in smaller parts (for example, the
  network location is a single string), and % escapes are not expanded.

It is the caller job to unquote them before using them.

For instance, a character like "]" cannot be supplied in a host or
urllib will incorrectly interpret it using ipv6 syntax.

Fix #568
2017-04-13 15:10:40 +02:00
Honza Král 2f62f9e3d4 version bump for 5.3 2017-03-30 22:32:38 -07:00
Honza Král fe897ebe0d Wait_for_completion defaults to true 2017-03-26 14:11:01 +02:00
Honza Král c32e3e52f7 new API compatibility 2017-03-21 13:49:17 +01:00
allias888andHonza Král 05ad5ef96b wait for completion is on by default (#550) 2017-03-12 14:51:40 -07:00
Honza Král 597bf7ade9 Log proper headers in trace logs 2017-03-05 11:19:01 -08:00
Husain ZafarandHonza Král ed5a1cce8e This commit modifies the elasticsearch/connection_pool.py file to solve the list index out of range error. (#539)
Fixes #371
2017-02-19 16:04:32 +05:30
Honza Král f638c3f625 bump version to 2.0 2017-02-12 16:26:02 +01:00
Glen SmithandGitHub 1d3e7022b5 Merge pull request #532 from keith-pinto/fix_doc
fix ordering of arguments in documentation for client's get method
2017-02-11 10:54:26 -07:00
keith pinto 52f8fd86ac fix order of arguments in documentation for client's get method 2017-02-09 04:57:42 +05:30
Honza Král a180459d69 Update API parameters to 5.x 2017-02-08 21:07:29 +01:00
Honza Král a96f5f7284 Sending raw text as body is no longer supported, wrap scroll_id 2017-02-08 20:51:13 +01:00
Honza Král d862c8a799 Add content-type default headers with application/json 2017-02-08 20:50:50 +01:00
Honza Král f38fa51fea When user is passing params we need to make a copy
Fixes #517
2017-01-17 03:10:50 +01:00
Honza Král 5ecfc70a16 bunp version to 5.1.0 for release 2017-01-11 15:45:55 +01:00
Honza Král 0bf58d7717 Updated API 2017-01-11 15:42:33 +01:00
Yotam TanayandHonza Král a644af0e07 Fix error where address is null in _get_host_info (#506)
* Fix error where address is null in _get_host_info

* Bump CI
2017-01-03 15:12:15 +01:00
Honza Král 8107bbcf93 update headers in lowercase to allow overriding of auth headers 2017-01-03 15:07:28 +01:00
Honza Král b9ba12977f Refactored connection error handling 2016-12-15 16:46:05 +11:00
Honza Král c2fc5aa18c Be more explicit with stats_only behavior 2016-12-15 10:21:38 +11:00
Javier AguirreandHonza Král 8e69b98844 Fix UnboundLocalError response (#476) (#481) 2016-12-06 18:10:44 +01:00
Honza Král fe53ab588e Fix sniffing for 5.0
Fixes #477
2016-12-06 12:17:57 +01:00