Skip to content

Commit eb52a02

Browse files
update connector API documentation examples (#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
----

docs/examples/1a56df055b94466ca76818e0858752c6.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/openai_embeddings",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="openai_embeddings",
9+
inference_config={
1110
"service": "openai",
1211
"service_settings": {
1312
"api_key": "<api_key>",

docs/examples/1a9e03ce0355872a7db27fedc783fbec.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/rerank/google_vertex_ai_rerank",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="rerank",
8+
inference_id="google_vertex_ai_rerank",
9+
inference_config={
1110
"service": "googlevertexai",
1211
"service_settings": {
1312
"service_account_json": "<service_account_json>",

docs/examples/1b60ad542abb511cbd926ac8c55b609c.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/sparse_embedding/my-elser-model",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="sparse_embedding",
8+
inference_id="my-elser-model",
9+
inference_config={
1110
"service": "elser",
1211
"service_settings": {
1312
"adaptive_allocations": {

docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.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/azure_ai_studio_embeddings",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="azure_ai_studio_embeddings",
9+
inference_config={
1110
"service": "azureaistudio",
1211
"service_settings": {
1312
"api_key": "<api_key>",

docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"GET",
8-
"/_connector",
9-
params={
10-
"service_type": "sharepoint_online"
11-
},
6+
resp = client.connector.list(
7+
service_type="sharepoint_online",
128
)
139
print(resp)
1410
----

docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.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/azure_ai_studio_embeddings",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="text_embedding",
8+
inference_id="azure_ai_studio_embeddings",
9+
inference_config={
1110
"service": "azureaistudio",
1211
"service_settings": {
1312
"api_key": "<api_key>",

docs/examples/24f4dfdf9922d5aa79151675b7767742.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:383
2+
// search/search-your-data/paginate-search-results.asciidoc:385
33

44
[source, python]
55
----

docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc

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

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_connector/my-connector",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"index_name": "search-google-drive",
12-
"name": "My Connector",
13-
"service_type": "google_drive"
14-
},
6+
resp = client.connector.put(
7+
connector_id="my-connector",
8+
index_name="search-google-drive",
9+
name="My Connector",
10+
service_type="google_drive",
1511
)
1612
print(resp)
1713
----

docs/examples/3758b8f2ab9f6f28a764ee6c42c85766.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:548
2+
// search/search-your-data/paginate-search-results.asciidoc:550
33

44
[source, python]
55
----

docs/examples/398389933901b572a06a752bc780af7c.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/completion/anthropic_completion",
9-
headers={"Content-Type": "application/json"},
10-
body={
6+
resp = client.inference.put(
7+
task_type="completion",
8+
inference_id="anthropic_completion",
9+
inference_config={
1110
"service": "anthropic",
1211
"service_settings": {
1312
"api_key": "<api_key>",

docs/examples/3b6718257421b5419bf4cd6a7303c57e.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.get_geoip_database(
7-
id="my-database-id",
8-
body=None,
6+
resp = client.perform_request(
7+
"GET",
8+
"/_ingest/geoip/database/my-database-id",
99
)
1010
print(resp)
1111
----

docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc

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

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_connector/my-connector/_pipeline",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"pipeline": {
12-
"extract_binary_content": True,
13-
"name": "my-connector-pipeline",
14-
"reduce_whitespace": True,
15-
"run_ml_inference": True
16-
}
6+
resp = client.connector.update_pipeline(
7+
connector_id="my-connector",
8+
pipeline={
9+
"extract_binary_content": True,
10+
"name": "my-connector-pipeline",
11+
"reduce_whitespace": True,
12+
"run_ml_inference": True
1713
},
1814
)
1915
print(resp)

docs/examples/430705509f8367aef92be413f702520b.asciidoc

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

44
[source, python]
55
----
6-
resp = client.perform_request(
7-
"PUT",
8-
"/_connector/my-connector/_status",
9-
headers={"Content-Type": "application/json"},
10-
body={
11-
"status": "needs_configuration"
12-
},
6+
resp = client.connector.update_status(
7+
connector_id="my-connector",
8+
status="needs_configuration",
139
)
1410
print(resp)
1511
----

docs/examples/4342ccf6cc24fd80bd3cd1f9a4c2ef8e.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:513
2+
// search/search-your-data/paginate-search-results.asciidoc:515
33

44
[source, python]
55
----

docs/examples/47909e194d10743093f4a22c27a85925.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:196
2+
// search/search-your-data/paginate-search-results.asciidoc:198
33

44
[source, python]
55
----

0 commit comments

Comments
 (0)