forked from elastic/elasticsearch-py
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use request converter to generate python examples
- Loading branch information
1 parent
47dcd2b
commit 56c5029
Showing
3,179 changed files
with
67,293 additions
and
4,263 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// rest-api/security/clear-cache.asciidoc:69 | ||
|
||
[source, python] | ||
---- | ||
resp = client.security.clear_cached_realms( | ||
realms="default_file,ldap1", | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// indices/forcemerge.asciidoc:210 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.forcemerge( | ||
index=".ds-my-data-stream-2099.03.07-000001", | ||
max_num_segments="1", | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// query-dsl/pinned-query.asciidoc:13 | ||
|
||
[source, python] | ||
---- | ||
resp = client.search( | ||
query={ | ||
"pinned": { | ||
"ids": [ | ||
"1", | ||
"4", | ||
"100" | ||
], | ||
"organic": { | ||
"match": { | ||
"description": "iphone" | ||
} | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:85 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.create( | ||
index="my-index-000001", | ||
settings={ | ||
"analysis": { | ||
"analyzer": { | ||
"my_analyzer": { | ||
"tokenizer": "whitespace", | ||
"filter": [ | ||
"stemmer" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// watcher/example-watches/example-watch-clusterstatus.asciidoc:193 | ||
|
||
[source, python] | ||
---- | ||
resp = client.watcher.put_watch( | ||
id="cluster_health_watch", | ||
trigger={ | ||
"schedule": { | ||
"interval": "10s" | ||
} | ||
}, | ||
input={ | ||
"http": { | ||
"request": { | ||
"host": "localhost", | ||
"port": 9200, | ||
"path": "/_cluster/health" | ||
} | ||
} | ||
}, | ||
condition={ | ||
"compare": { | ||
"ctx.payload.status": { | ||
"eq": "red" | ||
} | ||
} | ||
}, | ||
actions={ | ||
"send_email": { | ||
"email": { | ||
"to": "username@example.org", | ||
"subject": "Cluster Status Warning", | ||
"body": "Cluster status is RED" | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// migration/apis/feature-migration.asciidoc:152 | ||
|
||
[source, python] | ||
---- | ||
resp = client.migration.post_feature_upgrade() | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// scripting/common-script-uses.asciidoc:107 | ||
|
||
[source, python] | ||
---- | ||
resp = client.search( | ||
index="my-index", | ||
query={ | ||
"match": { | ||
"http.clientip": "40.135.0.0" | ||
} | ||
}, | ||
fields=[ | ||
"http.clientip" | ||
], | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// indices/shard-stores.asciidoc:134 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.shard_stores() | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// search/search-your-data/search-template.asciidoc:443 | ||
|
||
[source, python] | ||
---- | ||
resp = client.render_search_template( | ||
source="{ \"query\": {{#toJson}}my_query{{/toJson}} }", | ||
params={ | ||
"my_query": { | ||
"match_all": {} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// analysis/tokenfilters/asciifolding-tokenfilter.asciidoc:21 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.analyze( | ||
tokenizer="standard", | ||
filter=[ | ||
"asciifolding" | ||
], | ||
text="açaí à la carte", | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// analysis/analyzers/lang-analyzer.asciidoc:1204 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.create( | ||
index="italian_example", | ||
settings={ | ||
"analysis": { | ||
"filter": { | ||
"italian_elision": { | ||
"type": "elision", | ||
"articles": [ | ||
"c", | ||
"l", | ||
"all", | ||
"dall", | ||
"dell", | ||
"nell", | ||
"sull", | ||
"coll", | ||
"pell", | ||
"gl", | ||
"agl", | ||
"dagl", | ||
"degl", | ||
"negl", | ||
"sugl", | ||
"un", | ||
"m", | ||
"t", | ||
"s", | ||
"v", | ||
"d" | ||
], | ||
"articles_case": True | ||
}, | ||
"italian_stop": { | ||
"type": "stop", | ||
"stopwords": "_italian_" | ||
}, | ||
"italian_keywords": { | ||
"type": "keyword_marker", | ||
"keywords": [ | ||
"esempio" | ||
] | ||
}, | ||
"italian_stemmer": { | ||
"type": "stemmer", | ||
"language": "light_italian" | ||
} | ||
}, | ||
"analyzer": { | ||
"rebuilt_italian": { | ||
"tokenizer": "standard", | ||
"filter": [ | ||
"italian_elision", | ||
"lowercase", | ||
"italian_stop", | ||
"italian_keywords", | ||
"italian_stemmer" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// inference/service-elasticsearch.asciidoc:111 | ||
|
||
[source, python] | ||
---- | ||
resp = client.perform_request( | ||
"PUT", | ||
"/_inference/text_embedding/my-e5-model", | ||
headers={"Content-Type": "application/json"}, | ||
body={ | ||
"service": "elasticsearch", | ||
"service_settings": { | ||
"num_allocations": 1, | ||
"num_threads": 1, | ||
"model_id": ".multilingual-e5-small" | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// ingest/common-log-format-example.asciidoc:161 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.put_index_template( | ||
name="my-data-stream-template", | ||
index_patterns=[ | ||
"my-data-stream*" | ||
], | ||
data_stream={}, | ||
priority=500, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// alias.asciidoc:52 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.update_aliases( | ||
actions=[ | ||
{ | ||
"add": { | ||
"index": "logs-*", | ||
"alias": "logs" | ||
} | ||
} | ||
], | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// analysis/tokenfilters/asciifolding-tokenfilter.asciidoc:118 | ||
|
||
[source, python] | ||
---- | ||
resp = client.indices.create( | ||
index="asciifold_example", | ||
settings={ | ||
"analysis": { | ||
"analyzer": { | ||
"standard_asciifolding": { | ||
"tokenizer": "standard", | ||
"filter": [ | ||
"my_ascii_folding" | ||
] | ||
} | ||
}, | ||
"filter": { | ||
"my_ascii_folding": { | ||
"type": "asciifolding", | ||
"preserve_original": True | ||
} | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// transform/apis/start-transform.asciidoc:79 | ||
|
||
[source, python] | ||
---- | ||
resp = client.transform.start_transform( | ||
transform_id="ecommerce_transform", | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This file is autogenerated, DO NOT EDIT | ||
// aggregations.asciidoc:36 | ||
|
||
[source, python] | ||
---- | ||
resp = client.search( | ||
index="my-index-000001", | ||
aggs={ | ||
"my-agg-name": { | ||
"terms": { | ||
"field": "my-field" | ||
} | ||
} | ||
}, | ||
) | ||
print(resp) | ||
---- |
Oops, something went wrong.