Skip to content

Commit d1b99c8

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-ci-3.12
2 parents 18867bf + 5183a07 commit d1b99c8

File tree

9 files changed

+96
-30
lines changed

9 files changed

+96
-30
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ jobs:
1212
- name: Set up Python 3.x
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.x
15+
python-version: "3.11"
1616
- name: Install dependencies
17-
run: python3 -m pip install nox
17+
run: |
18+
python3 -m pip install nox
1819
- name: Lint the code
1920
run: nox -s lint
2021

@@ -28,7 +29,7 @@ jobs:
2829

2930
runs-on: ${{ matrix.runs-on }}
3031
name: test-${{ matrix.python-version }}
31-
continue-on-error: true
32+
continue-on-error: false
3233
steps:
3334
- name: Checkout Repository
3435
uses: actions/checkout@v3
@@ -37,10 +38,11 @@ jobs:
3738
with:
3839
python-version: ${{ matrix.python-version }}
3940
- name: Install Dependencies
40-
run: python -m pip install nox
41+
run: |
42+
python -m pip install nox
4143
- name: Run Tests
4244
shell: bash
4345
run: .ci/run-nox.sh
4446
env:
4547
PYTHON_VERSION: ${{ matrix.python-version }}
46-
NOX_SESSION: ${{ matrix.nox-session }}
48+
NOX_SESSION: ${{ matrix.nox-session }}

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build:
77
# to set AIOHTTP_NO_EXTENSIONS to 1 but it has to be done in
88
# https://readthedocs.org/dashboard/elasticsearch-py/environmentvariables/
99
# because of https://github.com/readthedocs/readthedocs.org/issues/6311
10-
python: "3"
10+
python: "3.12"
1111

1212
python:
1313
install:

dev-requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ twine
1515
build
1616
nox
1717

18-
# No wheels for Python 3.10 yet!
19-
numpy; python_version<"3.10"
20-
pandas; python_version<"3.10"
18+
numpy
19+
pandas
2120

2221
# Testing the 'search_mvt' API response
2322
mapbox-vector-tile
@@ -29,4 +28,4 @@ protobuf<4; python_version<="3.7"
2928
# Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5)
3029
sphinx>2
3130
sphinx-rtd-theme>0.5
32-
sphinx-autodoc-typehints
31+
sphinx-autodoc-typehints

docs/guide/release-notes.asciidoc

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[[release-notes]]
22
== Release notes
33

4+
* <<rn-8-10-1>>
5+
* <<rn-8-10-0>>
6+
* <<rn-8-9-0>>
7+
* <<rn-8-8-1>>
48
* <<rn-8-8-0>>
59
* <<rn-8-7-0>>
610
* <<rn-8-6-2>>
@@ -27,6 +31,33 @@
2731
* <<rn-8-1-0>>
2832
* <<rn-8-0-0>>
2933

34+
[discrete]
35+
[[rn-8-10-1]]
36+
=== 8.10.1 (2023-10-13)
37+
38+
- Removed deprecation warnings when using `body` parameter
39+
- Fixed some type hints to use covariant Sequence instead of invariant List
40+
41+
[discrete]
42+
[[rn-8-10-0]]
43+
=== 8.10.0 (2023-09-22)
44+
45+
- Added the Query rules APIs
46+
- Added the Synonyms APIs
47+
48+
[discrete]
49+
[[rn-8-9-0]]
50+
=== 8.9.0 (2023-08-10)
51+
52+
- Added the `cluster.info` API
53+
- Updated the `inference_config` argument in `ml.put_trained_model` API to reflect an improvement in the specification
54+
55+
[discrete]
56+
[[rn-8-8-1]]
57+
=== 8.8.1 (2023-07-06)
58+
59+
* Added the `rank` parameter to the `search` API
60+
3061
[discrete]
3162
[[rn-8-8-0]]
3263
=== 8.8.0 (2023-05-25)
@@ -39,21 +70,21 @@
3970
[[rn-8-7-0]]
4071
=== 8.7.0 (2023-04-06)
4172

42-
* Added the ``health_report`` API
43-
* Added the ``transform.schedule_now_transform`` API
44-
* Added the ``from_`` request parameter to the ``transform.start_transform`` API
45-
* Added the ``buffer``, ``grid_agg``, and ``with_labels`` parameters to the ``search_mvt`` API
46-
* Added the ``allow_auto_create`` parameter to the ``cluster.create_component_template`` API
47-
* Added the ``delete_user_annotations`` parameter to the ``ml.delete_job``, ``ml.reset_job`` API
48-
* Added the ``start`` and ``end`` parameters to the ``ml.preview_datafeed`` API
49-
* Added the ``priority`` parameter to the ``ml.start_datafeed`` API
50-
* Added the ``job_id`` parameter to the ``ml.update_datafeed`` API
51-
* Added the ``model_prune_window`` parameter to the ``ml.update_job`` API
52-
* Added the ``feature_states`` parameter to the ``snapshot.restore_snapshot`` API
53-
* Added the ``timeout`` parameter to the ``transform.get_transform_stats`` API
54-
* Added the ``from_`` parameter to the ``transform.start_transform`` API
55-
* Changed the ``input`` parameter of the ``ml.put_trained_models`` API from required to optional
56-
* Fixed the ``cluster.create_component_template`` API by removing the erroneously provided ``aliases``, ``mappings``, and ``settings`` parameters. Only the ``template`` parameter should be used for specifying component templates.
73+
* Added the `health_report` API
74+
* Added the `transform.schedule_now_transform` API
75+
* Added the `from_` request parameter to the `transform.start_transform` API
76+
* Added the `buffer`, `grid_agg`, and `with_labels` parameters to the `search_mvt` API
77+
* Added the `allow_auto_create` parameter to the `cluster.create_component_template` API
78+
* Added the `delete_user_annotations` parameter to the `ml.delete_job`, `ml.reset_job` API
79+
* Added the `start` and `end` parameters to the `ml.preview_datafeed` API
80+
* Added the `priority` parameter to the `ml.start_datafeed` API
81+
* Added the `job_id` parameter to the `ml.update_datafeed` API
82+
* Added the `model_prune_window` parameter to the `ml.update_job` API
83+
* Added the `feature_states` parameter to the `snapshot.restore_snapshot` API
84+
* Added the `timeout` parameter to the `transform.get_transform_stats` API
85+
* Added the `from_` parameter to the `transform.start_transform` API
86+
* Changed the `input` parameter of the `ml.put_trained_models` API from required to optional
87+
* Fixed the `cluster.create_component_template` API by removing the erroneously provided `aliases`, `mappings`, and `settings` parameters. Only the `template` parameter should be used for specifying component templates.
5788

5889
[discrete]
5990
[[rn-8-6-2]]

docs/sphinx/async.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,31 @@ For example if using FastAPI that might look like this:
9494

9595
.. code-block:: python
9696
97+
import os
98+
from contextlib import asynccontextmanager
99+
97100
from fastapi import FastAPI
98101
from elasticsearch import AsyncElasticsearch
99102
100-
app = FastAPI()
101-
es = AsyncElasticsearch()
103+
ELASTICSEARCH_URL = os.environ["ELASTICSEARCH_URL"]
104+
es = None
102105
103-
# This gets called once the app is shutting down.
104-
@app.on_event("shutdown")
105-
async def app_shutdown():
106+
@asynccontextmanager
107+
async def lifespan(app: FastAPI):
108+
global es
109+
es = AsyncElasticsearch(ELASTICSEARCH_URL)
110+
yield
106111
await es.close()
107112
113+
app = FastAPI(lifespan=lifespan)
114+
115+
@app.get("/")
116+
async def main():
117+
return await es.info()
118+
119+
You can run this example by saving it to ``main.py`` and executing
120+
``ELASTICSEARCH_URL=http://localhost:9200 uvicorn main:app``.
121+
108122

109123
Async Helpers
110124
-------------

elasticsearch/_async/client/ml.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,7 @@ async def put_trained_model_vocabulary(
33033303
human: t.Optional[bool] = None,
33043304
merges: t.Optional[t.Sequence[str]] = None,
33053305
pretty: t.Optional[bool] = None,
3306+
scores: t.Optional[t.Sequence[float]] = None,
33063307
) -> ObjectApiResponse[t.Any]:
33073308
"""
33083309
Creates a trained model vocabulary
@@ -3312,6 +3313,7 @@ async def put_trained_model_vocabulary(
33123313
:param model_id: The unique identifier of the trained model.
33133314
:param vocabulary: The model vocabulary, which must not be empty.
33143315
:param merges: The optional model merges if required by the tokenizer.
3316+
:param scores: The optional vocabulary value scores if required by the tokenizer.
33153317
"""
33163318
if model_id in SKIP_IN_PATH:
33173319
raise ValueError("Empty value passed for parameter 'model_id'")
@@ -3332,6 +3334,8 @@ async def put_trained_model_vocabulary(
33323334
__body["merges"] = merges
33333335
if pretty is not None:
33343336
__query["pretty"] = pretty
3337+
if scores is not None:
3338+
__body["scores"] = scores
33353339
__headers = {"accept": "application/json", "content-type": "application/json"}
33363340
return await self.perform_request( # type: ignore[return-value]
33373341
"PUT", __path, params=__query, headers=__headers, body=__body

elasticsearch/_async/client/transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async def delete_transform(
2929
self,
3030
*,
3131
transform_id: str,
32+
delete_dest_index: t.Optional[bool] = None,
3233
error_trace: t.Optional[bool] = None,
3334
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3435
force: t.Optional[bool] = None,
@@ -42,6 +43,9 @@ async def delete_transform(
4243
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-transform.html>`_
4344
4445
:param transform_id: Identifier for the transform.
46+
:param delete_dest_index: If this value is true, the destination index is deleted
47+
together with the transform. If false, the destination index will not be
48+
deleted
4549
:param force: If this value is false, the transform must be stopped before it
4650
can be deleted. If true, the transform is deleted regardless of its current
4751
state.
@@ -52,6 +56,8 @@ async def delete_transform(
5256
raise ValueError("Empty value passed for parameter 'transform_id'")
5357
__path = f"/_transform/{_quote(transform_id)}"
5458
__query: t.Dict[str, t.Any] = {}
59+
if delete_dest_index is not None:
60+
__query["delete_dest_index"] = delete_dest_index
5561
if error_trace is not None:
5662
__query["error_trace"] = error_trace
5763
if filter_path is not None:

elasticsearch/_sync/client/ml.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,7 @@ def put_trained_model_vocabulary(
33033303
human: t.Optional[bool] = None,
33043304
merges: t.Optional[t.Sequence[str]] = None,
33053305
pretty: t.Optional[bool] = None,
3306+
scores: t.Optional[t.Sequence[float]] = None,
33063307
) -> ObjectApiResponse[t.Any]:
33073308
"""
33083309
Creates a trained model vocabulary
@@ -3312,6 +3313,7 @@ def put_trained_model_vocabulary(
33123313
:param model_id: The unique identifier of the trained model.
33133314
:param vocabulary: The model vocabulary, which must not be empty.
33143315
:param merges: The optional model merges if required by the tokenizer.
3316+
:param scores: The optional vocabulary value scores if required by the tokenizer.
33153317
"""
33163318
if model_id in SKIP_IN_PATH:
33173319
raise ValueError("Empty value passed for parameter 'model_id'")
@@ -3332,6 +3334,8 @@ def put_trained_model_vocabulary(
33323334
__body["merges"] = merges
33333335
if pretty is not None:
33343336
__query["pretty"] = pretty
3337+
if scores is not None:
3338+
__body["scores"] = scores
33353339
__headers = {"accept": "application/json", "content-type": "application/json"}
33363340
return self.perform_request( # type: ignore[return-value]
33373341
"PUT", __path, params=__query, headers=__headers, body=__body

elasticsearch/_sync/client/transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def delete_transform(
2929
self,
3030
*,
3131
transform_id: str,
32+
delete_dest_index: t.Optional[bool] = None,
3233
error_trace: t.Optional[bool] = None,
3334
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3435
force: t.Optional[bool] = None,
@@ -42,6 +43,9 @@ def delete_transform(
4243
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-transform.html>`_
4344
4445
:param transform_id: Identifier for the transform.
46+
:param delete_dest_index: If this value is true, the destination index is deleted
47+
together with the transform. If false, the destination index will not be
48+
deleted
4549
:param force: If this value is false, the transform must be stopped before it
4650
can be deleted. If true, the transform is deleted regardless of its current
4751
state.
@@ -52,6 +56,8 @@ def delete_transform(
5256
raise ValueError("Empty value passed for parameter 'transform_id'")
5357
__path = f"/_transform/{_quote(transform_id)}"
5458
__query: t.Dict[str, t.Any] = {}
59+
if delete_dest_index is not None:
60+
__query["delete_dest_index"] = delete_dest_index
5561
if error_trace is not None:
5662
__query["error_trace"] = error_trace
5763
if filter_path is not None:

0 commit comments

Comments
 (0)