Skip to content

Commit eb52a02

Browse files
update connector API documentation examples (elastic#2644)
1 parent 4ee4650 commit eb52a02

File tree

83 files changed

+331
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+331
-447
lines changed

docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_inference/text_embedding/my-e5-model",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="my-e5-model",
9+
inference_config={
1110
"service": "elasticsearch",
1211
"service_settings": {
1312
"num_allocations": 1,

docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_connector/my-connector/_api_key_id",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"api_key_id": "my-api-key-id",
12-
"api_key_secret_id": "my-connector-secret-id"
13-
},
6+
resp = client.connector.update_api_key_id(
7+
connector_id="my-connector",
8+
api_key_id="my-api-key-id",
9+
api_key_secret_id="my-connector-secret-id",
1410
)
1511
print(resp)
1612
----

docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_inference/text_embedding/google_vertex_ai_embeddings",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="google_vertex_ai_embeddings",
9+
inference_config={
1110
"service": "googlevertexai",
1211
"service_settings": {
1312
"service_account_json": "<service_account_json>",

docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_inference/text_embedding/amazon_bedrock_embeddings",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="amazon_bedrock_embeddings",
9+
inference_config={
1110
"service": "amazonbedrock",
1211
"service_settings": {
1312
"access_key": "<aws_access_key>",

docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,26 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_connector/my-g-drive-connector/_filtering",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"rules": [
12-
{
13-
"field": "file_extension",
14-
"id": "exclude-txt-files",
15-
"order": 0,
16-
"policy": "exclude",
17-
"rule": "equals",
18-
"value": "txt"
19-
},
20-
{
21-
"field": "_",
22-
"id": "DEFAULT",
23-
"order": 1,
24-
"policy": "include",
25-
"rule": "regex",
26-
"value": ".*"
27-
}
28-
]
29-
},
6+
resp = client.connector.update_filtering(
7+
connector_id="my-g-drive-connector",
8+
rules=[
9+
{
10+
"field": "file_extension",
11+
"id": "exclude-txt-files",
12+
"order": 0,
13+
"policy": "exclude",
14+
"rule": "equals",
15+
"value": "txt"
16+
},
17+
{
18+
"field": "_",
19+
"id": "DEFAULT",
20+
"order": 1,
21+
"policy": "include",
22+
"rule": "regex",
23+
"value": ".*"
24+
}
25+
],
3026
)
3127
print(resp)
3228
----

docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is autogenerated, DO NOT EDIT
2-
// search/point-in-time-api.asciidoc:152
2+
// search/point-in-time-api.asciidoc:190
33

44
[source, python]
55
----

docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is autogenerated, DO NOT EDIT
2-
// aggregations/metrics/scripted-metric-aggregation.asciidoc:59
2+
// aggregations/metrics/scripted-metric-aggregation.asciidoc:61
33

44
[source, python]
55
----

docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"POST",
8-
"/_inference/sparse_embedding/my-elser-model",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"input": "The sky above the port was the color of television tuned to a dead channel."
12-
},
6+
resp = client.inference.inference(
7+
task_type="sparse_embedding",
8+
inference_id="my-elser-model",
9+
input="The sky above the port was the color of television tuned to a dead channel.",
1310
)
1411
print(resp)
1512
----

docs/examples/187733e50c60350f3f75921bea3b72c2.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is autogenerated, DO NOT EDIT
2-
// search/search-your-data/paginate-search-results.asciidoc:613
2+
// search/search-your-data/paginate-search-results.asciidoc:615
33

44
[source, python]
55
----

docs/examples/19d60e4890cc57151d596326484d9076.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
[source, python]
55
----
6-
resp = client.ingest.delete_geoip_database(
7-
id="my-database-id",
8-
body=None,
6+
resp = client.perform_request(
7+
"DELETE",
8+
"/_ingest/geoip/database/my-database-id",
99
)
1010
print(resp)
1111
----

0 commit comments

Comments
 (0)