Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into annieh/add_setup_upgr…
Browse files Browse the repository at this point in the history
…ade_es_code_examples
  • Loading branch information
pquentin committed May 3, 2024
2 parents e14c267 + f9930b0 commit 6f05858
Show file tree
Hide file tree
Showing 70 changed files with 4,736 additions and 351 deletions.
2 changes: 1 addition & 1 deletion .buildkite/Dockerfile
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.8
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}

# Default UID/GID to 1000
Expand Down
5 changes: 4 additions & 1 deletion dev-requirements.txt
Expand Up @@ -15,10 +15,13 @@ twine
build
nox

numpy
pandas
orjson

# mmr for vectorstore
numpy
simsimd

# Testing the 'search_mvt' API response
mapbox-vector-tile
# Python 3.7 gets an old version of mapbox-vector-tile, requiring an
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc
@@ -1,4 +1,4 @@
// inference/put-inference.asciidoc:275
// inference/put-inference.asciidoc:381

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc
@@ -1,4 +1,4 @@
// inference/put-inference.asciidoc:369
// inference/put-inference.asciidoc:488

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc
@@ -1,4 +1,4 @@
// inference/post-inference.asciidoc:73
// inference/post-inference.asciidoc:197

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc
@@ -1,4 +1,4 @@
// docs/bulk.asciidoc:634
// docs/bulk.asciidoc:632

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:781
// aggregations/bucket/datehistogram-aggregation.asciidoc:782

[source, python]
----
Expand Down
7 changes: 0 additions & 7 deletions docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc
@@ -1,4 +1,4 @@
// inference/delete-inference.asciidoc:53
// inference/delete-inference.asciidoc:55

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:488
// aggregations/bucket/datehistogram-aggregation.asciidoc:489

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/5203560189ccab7122c03500147701ef.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:568
// aggregations/bucket/datehistogram-aggregation.asciidoc:569

[source, python]
----
Expand Down
17 changes: 17 additions & 0 deletions docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc
@@ -0,0 +1,17 @@
// inference/put-inference.asciidoc:529

[source, python]
----
resp = client.inference.put_model(
task_type="completion",
inference_id="openai-completion",
body={
"service": "openai",
"service_settings": {
"api_key": "<api_key>",
"model_id": "gpt-3.5-turbo",
},
},
)
print(resp)
----
19 changes: 19 additions & 0 deletions docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc
@@ -0,0 +1,19 @@
// inference/put-inference.asciidoc:552

[source, python]
----
resp = client.inference.put_model(
task_type="text_embedding",
inference_id="azure_openai_embeddings",
body={
"service": "azureopenai",
"service_settings": {
"api_key": "<api_key>",
"resource_name": "<resource_name>",
"deployment_id": "<deployment_id>",
"api_version": "2024-02-01",
},
},
)
print(resp)
----
18 changes: 18 additions & 0 deletions docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc
@@ -0,0 +1,18 @@
// inference/put-inference.asciidoc:353

[source, python]
----
resp = client.inference.put_model(
task_type="rerank",
inference_id="cohere-rerank",
body={
"service": "cohere",
"service_settings": {
"api_key": "<API-KEY>",
"model_id": "rerank-english-v3.0",
},
"task_settings": {"top_n": 10, "return_documents": True},
},
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc
@@ -1,4 +1,4 @@
// docs/bulk.asciidoc:612
// docs/bulk.asciidoc:610

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/9a02bd47c000a3d9a8911233c37c890f.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:366
// aggregations/bucket/datehistogram-aggregation.asciidoc:367

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc
@@ -1,4 +1,4 @@
// inference/put-inference.asciidoc:253
// inference/put-inference.asciidoc:335

[source, python]
----
Expand Down
@@ -1,10 +1,10 @@
// inference/put-inference.asciidoc:394
// inference/put-inference.asciidoc:513

[source, python]
----
resp = client.inference.put_model(
task_type="text_embedding",
inference_id="openai_embeddings",
inference_id="openai-embeddings",
body={
"service": "openai",
"service_settings": {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc
@@ -1,4 +1,4 @@
// inference/get-inference.asciidoc:69
// inference/get-inference.asciidoc:73

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/a84ffbaa4ffa68b22f6fe42d3b4f8dd5.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:588
// aggregations/bucket/datehistogram-aggregation.asciidoc:589

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc
@@ -1,4 +1,4 @@
// docs/bulk.asciidoc:501
// docs/bulk.asciidoc:499

[source, python]
----
Expand Down
11 changes: 11 additions & 0 deletions docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc
@@ -0,0 +1,11 @@
// inference/post-inference.asciidoc:102

[source, python]
----
resp = client.inference.inference(
task_type="completion",
inference_id="openai_chat_completions",
body={"input": "What is Elastic?"},
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/ba59a3b9a0a2694704b2bf9c6ad4a8cf.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:610
// aggregations/bucket/datehistogram-aggregation.asciidoc:611

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc
@@ -1,4 +1,4 @@
// docs/bulk.asciidoc:713
// docs/bulk.asciidoc:711

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc
@@ -1,4 +1,4 @@
// docs/bulk.asciidoc:766
// docs/bulk.asciidoc:764

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc
@@ -1,4 +1,4 @@
// inference/put-inference.asciidoc:300
// inference/put-inference.asciidoc:406

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:815
// aggregations/bucket/datehistogram-aggregation.asciidoc:816

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:417
// aggregations/bucket/datehistogram-aggregation.asciidoc:418

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:642
// aggregations/bucket/datehistogram-aggregation.asciidoc:643

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc
@@ -1,4 +1,4 @@
// search/search.asciidoc:956
// search/search.asciidoc:907

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc
@@ -1,4 +1,4 @@
// inference/put-inference.asciidoc:339
// inference/put-inference.asciidoc:445

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:698
// aggregations/bucket/datehistogram-aggregation.asciidoc:699

[source, python]
----
Expand Down
14 changes: 14 additions & 0 deletions docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc
@@ -0,0 +1,14 @@
// inference/post-inference.asciidoc:133

[source, python]
----
resp = client.inference.inference(
task_type="rerank",
inference_id="cohere_rerank",
body={
"input": ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"],
"query": "star wars main character",
},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/guide/release-notes.asciidoc
@@ -1,6 +1,7 @@
[[release-notes]]
== Release notes

* <<rn-8-13-1>>
* <<rn-8-13-0>>
* <<rn-8-12-1>>
* <<rn-8-12-0>>
Expand Down Expand Up @@ -36,6 +37,14 @@
* <<rn-8-1-0>>
* <<rn-8-0-0>>

[discrete]
[[rn-8-13-1]]
=== 8.13.1 (2024-05-03)

- Added ``force_synthetic_source`` to the Get API
- Added ``wait_for_completion`` to the Create trained model API
- Added ``typed_keys`` to the Query API key information API

[discrete]
[[rn-8-13-0]]
=== 8.13.0 (2024-03-22)
Expand Down
20 changes: 11 additions & 9 deletions elasticsearch/_async/client/cluster.py
Expand Up @@ -661,16 +661,17 @@ async def post_voting_config_exclusions(
)

@_rewrite_parameters(
body_fields=("template", "allow_auto_create", "meta", "version"),
body_fields=("template", "deprecated", "meta", "version"),
parameter_aliases={"_meta": "meta"},
)
async def put_component_template(
self,
*,
name: str,
template: t.Optional[t.Mapping[str, t.Any]] = None,
allow_auto_create: t.Optional[bool] = None,
cause: t.Optional[str] = None,
create: t.Optional[bool] = None,
deprecated: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand Down Expand Up @@ -698,13 +699,12 @@ async def put_component_template(
update settings API.
:param template: The template to be applied which includes mappings, settings,
or aliases configuration.
:param allow_auto_create: This setting overrides the value of the `action.auto_create_index`
cluster setting. If set to `true` in a template, then indices can be automatically
created using that template even if auto-creation of indices is disabled
via `actions.auto_create_index`. If set to `false` then data streams matching
the template must always be explicitly created.
:param cause:
:param create: If `true`, this request cannot replace or update existing component
templates.
:param deprecated: Marks this index template as deprecated. When creating or
updating a non-deprecated index template that uses deprecated components,
Elasticsearch will emit a deprecation warning.
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
Expand All @@ -724,6 +724,8 @@ async def put_component_template(
__path = f'/_component_template/{__path_parts["name"]}'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
Expand All @@ -739,8 +741,8 @@ async def put_component_template(
if not __body:
if template is not None:
__body["template"] = template
if allow_auto_create is not None:
__body["allow_auto_create"] = allow_auto_create
if deprecated is not None:
__body["deprecated"] = deprecated
if meta is not None:
__body["_meta"] = meta
if version is not None:
Expand Down

0 comments on commit 6f05858

Please sign in to comment.