Skip to content

Commit 86be9d1

Browse files
[Backport 8.15] use request converter to generate python examples (#2645)
* use request converter to generate python examples (#2643) * use request converter to generate examples * updated examples * use correct license (cherry picked from commit 4ee4650) * update connector API documentation examples --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
1 parent 4a02249 commit 86be9d1

File tree

3,168 files changed

+66990
-4011
lines changed

Some content is hidden

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

3,168 files changed

+66990
-4011
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ share/python-wheels/
2525
.installed.cfg
2626
*.egg
2727
MANIFEST
28+
node_modules
2829

2930
# PyInstaller
3031
# Usually these files are written by a python script from a template
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// rest-api/security/clear-cache.asciidoc:69
3+
4+
[source, python]
5+
----
6+
resp = client.security.clear_cached_realms(
7+
realms="default_file,ldap1",
8+
)
9+
print(resp)
10+
----
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// indices/forcemerge.asciidoc:210
3+
4+
[source, python]
5+
----
6+
resp = client.indices.forcemerge(
7+
index=".ds-my-data-stream-2099.03.07-000001",
8+
max_num_segments="1",
9+
)
10+
print(resp)
11+
----
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// query-dsl/pinned-query.asciidoc:13
3+
4+
[source, python]
5+
----
6+
resp = client.search(
7+
query={
8+
"pinned": {
9+
"ids": [
10+
"1",
11+
"4",
12+
"100"
13+
],
14+
"organic": {
15+
"match": {
16+
"description": "iphone"
17+
}
18+
}
19+
}
20+
},
21+
)
22+
print(resp)
23+
----
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:85
3+
4+
[source, python]
5+
----
6+
resp = client.indices.create(
7+
index="my-index-000001",
8+
settings={
9+
"analysis": {
10+
"analyzer": {
11+
"my_analyzer": {
12+
"tokenizer": "whitespace",
13+
"filter": [
14+
"stemmer"
15+
]
16+
}
17+
}
18+
}
19+
},
20+
)
21+
print(resp)
22+
----
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// watcher/example-watches/example-watch-clusterstatus.asciidoc:193
3+
4+
[source, python]
5+
----
6+
resp = client.watcher.put_watch(
7+
id="cluster_health_watch",
8+
trigger={
9+
"schedule": {
10+
"interval": "10s"
11+
}
12+
},
13+
input={
14+
"http": {
15+
"request": {
16+
"host": "localhost",
17+
"port": 9200,
18+
"path": "/_cluster/health"
19+
}
20+
}
21+
},
22+
condition={
23+
"compare": {
24+
"ctx.payload.status": {
25+
"eq": "red"
26+
}
27+
}
28+
},
29+
actions={
30+
"send_email": {
31+
"email": {
32+
"to": "username@example.org",
33+
"subject": "Cluster Status Warning",
34+
"body": "Cluster status is RED"
35+
}
36+
}
37+
},
38+
)
39+
print(resp)
40+
----
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// migration/apis/feature-migration.asciidoc:152
3+
4+
[source, python]
5+
----
6+
resp = client.migration.post_feature_upgrade()
7+
print(resp)
8+
----
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// scripting/common-script-uses.asciidoc:107
3+
4+
[source, python]
5+
----
6+
resp = client.search(
7+
index="my-index",
8+
query={
9+
"match": {
10+
"http.clientip": "40.135.0.0"
11+
}
12+
},
13+
fields=[
14+
"http.clientip"
15+
],
16+
)
17+
print(resp)
18+
----
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// indices/shard-stores.asciidoc:134
3+
4+
[source, python]
5+
----
6+
resp = client.indices.shard_stores()
7+
print(resp)
8+
----
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// search/search-your-data/search-template.asciidoc:443
3+
4+
[source, python]
5+
----
6+
resp = client.render_search_template(
7+
source="{ \"query\": {{#toJson}}my_query{{/toJson}} }",
8+
params={
9+
"my_query": {
10+
"match_all": {}
11+
}
12+
},
13+
)
14+
print(resp)
15+
----

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy