Description
Elasticsearch Python Client v8.0.0 Roadmap
- Drop support for Python 3.5 and earlier (Drop Python 2.7, 3.4, and 3.5 #1697, 849a169)
- Start using the
elastic-transport-python
package (https://github.com/elastic/elastic-transport-python/releases/tag/v8.0.0a1)- Using the package for basic operations (Integrate 'elastic-transport-python' #1759)
- Update RTD / elastic.co documentation (Migrate all user documentation to elastic.co #1765)
- Helpers using only new way of specifying transport options
- Sniffing (Add support for elastic-transport sniffing #1771)
- Require keyword-only arguments for APIs (done in generator)
- Generate structures and enums from the Elasticsearch Specification
- API responses accessible like objects with type hints
- Move body fields of JSON request bodies to top-level parameters (Switch to new API generator #1802)
- Move per-request transport parameters out of API functions
- Require explicit configuration for Elasticsearch nodes
- Remove the
elasticsearch.helpers.test
module (Remove 'elasticsearch.helpers.test', switch to pytest #1692)
Drop support for Python 3.5 and earlier
Downloads for recent Python versions have tapered off to be less than 10%. For v8.0.0 the client will only support Python 3.6+. This choice enables a lot of our other v8.0.0 roadmap items such as keyword-only arguments.
Read more: #1295
Start using the elastic-transport-python
package
The elastic-transport-python
package was created to enable supporting multiple clients with the same transport library.
With 8.0.0 we're able to switch from the built-in Transport
and other utilities to elastic-transport-python
.
Require keyword-only arguments for APIs
Due to the high number of arguments per API it's favorable for users to always use keyword arguments. In 7.x non-keyword arguments will be deprecated and in 8.0.0 they will be required and will raise a TypeError
if not passed via keyword. When types were first introduced to the module most parameters were marked as keyword-only but wasn't enforced unless using Mypy.
Generate structures and enums from the Elasticsearch Specification
The Elasticsearch Specification allows us to generate structures/enums for the Elasticsearch API. We'll generate these structures to be used for other 8.0 roadmap items related to types.
Read more: #1691
API responses accessible like objects with type hints
Currently API responses are raw deserialized data types without any way to access transport-level information. Starting in v8.0.0 responses will be objects which allow access to transport information like HTTP status, headers, and more. In addition to this JSON responses will include type hints and properties to access to each field.
Read more: #1695
Move body fields of JSON request bodies to top-level parameters
Today with the Elasticsearch client you have to write a JSON blob to the body
to pass any values within the HTTP body.
Unfortunately this is where some of the most complex data structures are for the Elasticsearch API (see query DSL, aggregations) which means we're unable to provide a good window into this opaque object via types or auto-complete.
As a part of this effort we'll be deprecating the body
parameter in 7.x and removing it in 9.0.0.
Read more: #1680
Move per-request transport parameters out of API functions
Currently we have request_timeout
, api_key
, and more that can be set on every API. But due to the expansion of JSON body field parameters we should move these away from being set on the API method and instead should have their own method to change a client's configuration per-request. Currently planning on a method like so:
client = Elasticsearch()
client.options(api_key="...").search(index="...")
# Previous was: client.search(index="...", api_key="...")
Require explicit configuration for Elasticsearch nodes
Current URL parsing and configuration has a bunch of inferred properties to the point of it being best to explicitly list scheme://host:port
so instead of having these inferred properties we're switching to an explicit approach. Users will now be required to configure scheme://host:port
for URLs or specify host:port
with use_ssl=True|False
Read more: #1690
Remove the elasticsearch.helpers.test
module
This module is only used in our test suite and isn't necessary to be packaged in the elasticsearch
namespace.