Skip to content

Commit f89871a

Browse files
committed
adding examples of how to import the helpers;
adding the client definition since ```bulk``` and ```es``` were used without context / definition changed from es to client to stay consistent with the quickstart naming convention
1 parent ee1dd75 commit f89871a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/sphinx/helpers.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ Helpers
55

66
Collection of simple helper functions that abstract some specifics of the raw API.
77

8+
Connecting
9+
----------
10+
11+
.. code-block:: python
12+
13+
from elasticsearch import Elasticsearch, helpers
14+
15+
client = Elasticsearch(cloud_id="YOUR_CLOUD_ID", api_key="YOUR_API_KEY")
16+
817
918
Bulk helpers
1019
------------
@@ -74,6 +83,8 @@ document is like ``{"word": "<myword>"}``.
7483

7584
.. code:: python
7685
86+
from elasticsearch.helpers import bulk
87+
7788
def gendata():
7889
mywords = ['foo', 'bar', 'baz']
7990
for word in mywords:
@@ -82,7 +93,7 @@ document is like ``{"word": "<myword>"}``.
8293
"word": word,
8394
}
8495
85-
bulk(es, gendata())
96+
bulk(client, gendata())
8697
8798
8899
For a more complete and complex example please take a look at

0 commit comments

Comments
 (0)