Skip to content

Commit

Permalink
use request converter to generate python examples
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Aug 23, 2024
1 parent 47dcd2b commit 56c5029
Show file tree
Hide file tree
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.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
node_modules

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
10 changes: 10 additions & 0 deletions docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc
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)
----
11 changes: 11 additions & 0 deletions docs/examples/004743b9c9f61588926ccf734696b713.asciidoc
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)
----
23 changes: 23 additions & 0 deletions docs/examples/004a17b42ab5155bb61da797a006fa9f.asciidoc
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)
----
22 changes: 22 additions & 0 deletions docs/examples/006e0e16c9f1da58c0bfe57377f7fc38.asciidoc
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)
----
40 changes: 40 additions & 0 deletions docs/examples/007179b5e241da650562a5f0a5007823.asciidoc
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)
----
8 changes: 8 additions & 0 deletions docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc
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)
----
18 changes: 18 additions & 0 deletions docs/examples/0091fc75271b1fbbd4269622a4881e8b.asciidoc
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)
----
8 changes: 8 additions & 0 deletions docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc
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)
----
15 changes: 15 additions & 0 deletions docs/examples/00c05aa931fc985985e3e21c93cf43ff.asciidoc
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)
----
14 changes: 14 additions & 0 deletions docs/examples/00d65f7b9daa1c6b18eedd8ace206bae.asciidoc
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)
----
69 changes: 69 additions & 0 deletions docs/examples/00e0c964c79fcc1876ab957da2ffce82.asciidoc
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)
----
20 changes: 20 additions & 0 deletions docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc
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)
----
15 changes: 15 additions & 0 deletions docs/examples/010d5e901a2690fa7b2396edbe6cd463.asciidoc
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)
----
17 changes: 13 additions & 4 deletions docs/examples/0163af36c8472ac0c5160c8b716f5b26.asciidoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:58

[source, python]
Expand All @@ -6,10 +7,18 @@ resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
body={
"query": {"term": {"type": "t-shirt"}},
"aggs": {"avg_price": {"avg": {"field": "price"}}},
query={
"term": {
"type": "t-shirt"
}
},
aggs={
"avg_price": {
"avg": {
"field": "price"
}
}
},
)
print(resp)
----
----
17 changes: 17 additions & 0 deletions docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc
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)
----
28 changes: 28 additions & 0 deletions docs/examples/019e329ed5a930aef825266822e7377a.asciidoc
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)
----
10 changes: 10 additions & 0 deletions docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc
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)
----
17 changes: 17 additions & 0 deletions docs/examples/01da9e0620e48270617fc248e6415cac.asciidoc
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)
----
Loading

0 comments on commit 56c5029

Please sign in to comment.