Skip to content

Commit e2b1f18

Browse files
committed
Fix helper examples and section structure
1 parent 24524fa commit e2b1f18

File tree

4 files changed

+81
-48
lines changed

4 files changed

+81
-48
lines changed

README

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ Official low-level client for Elasticsearch. Its goal is to provide common
55
ground for all Elasticsearch-related code in Python; because of this it tries
66
to be opinion-free and very extendable.
77

8-
For a more high level client library with more limited scope, have a look at
9-
`elasticsearch-dsl`_ - a more pythonic library sitting on top of
10-
``elasticsearch-py``.
118

12-
It provides a more convenient and idiomatic way to write and manipulate
13-
`queries`_. It stays close to the Elasticsearch JSON DSL, mirroring its
14-
terminology and structure while exposing the whole range of the DSL from Python
15-
either directly using defined classes or a queryset-like expressions.
9+
Installation
10+
------------
1611

17-
It also provides an optional `persistence layer`_ for working with documents as
18-
Python objects in an ORM-like fashion: defining mappings, retrieving and saving
19-
documents, wrapping the document data in user-defined classes.
12+
Install the ``elasticsearch`` package with `pip
13+
<https://pypi.org/project/elasticsearch>`_::
14+
15+
$ python -m pip install elasticsearch
16+
17+
If your application uses async/await in Python you can install with
18+
the ``async`` extra::
19+
20+
$ python -m pip install elasticsearch[async]
21+
22+
Read more about `how to use asyncio with this project <async>`_.
23+
24+
.. _async: https://elasticsearch-py.readthedocs.io/en/master/async.html
2025

21-
.. _elasticsearch-dsl: https://elasticsearch-dsl.readthedocs.io/
22-
.. _queries: https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html
23-
.. _persistence layer: https://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html#doctype
2426

2527
Compatibility
2628
-------------
@@ -58,14 +60,6 @@ The recommended way to set your requirements in your `setup.py` or
5860
If you have a need to have multiple versions installed at the same time older
5961
versions are also released as ``elasticsearch2`` and ``elasticsearch5``.
6062

61-
Installation
62-
------------
63-
64-
Install the ``elasticsearch`` package with `pip
65-
<https://pypi.python.org/pypi/elasticsearch>`_::
66-
67-
pip install elasticsearch
68-
6963

7064
Example use
7165
-----------
@@ -117,7 +111,6 @@ Using SSL Context with a self-signed cert use-case::
117111
>>> es.info()
118112

119113

120-
121114
Features
122115
--------
123116

@@ -135,10 +128,31 @@ The client's features include:
135128
* pluggable architecture
136129

137130

131+
Elasticsearch-DSL
132+
-----------------
133+
134+
For a more high level client library with more limited scope, have a look at
135+
`elasticsearch-dsl`_ - a more pythonic library sitting on top of
136+
``elasticsearch-py``.
137+
138+
`elasticsearch-dsl`_ provides a more convenient and idiomatic way to write and manipulate
139+
`queries`_ by mirroring the terminology and structure of Elasticsearch JSON DSL
140+
while exposing the whole range of the DSL from Python
141+
either directly using defined classes or a queryset-like expressions.
142+
143+
It also provides an optional `persistence layer`_ for working with documents as
144+
Python objects in an ORM-like fashion: defining mappings, retrieving and saving
145+
documents, wrapping the document data in user-defined classes.
146+
147+
.. _elasticsearch-dsl: https://elasticsearch-dsl.readthedocs.io/
148+
.. _queries: https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html
149+
.. _persistence layer: https://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html#doctype
150+
151+
138152
License
139153
-------
140154

141-
Copyright 2019 Elasticsearch
155+
Copyright 2020 Elasticsearch B.V
142156

143157
Licensed under the Apache License, Version 2.0 (the "License");
144158
you may not use this file except in compliance with the License.
@@ -152,7 +166,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
152166
See the License for the specific language governing permissions and
153167
limitations under the License.
154168

155-
Build status
169+
Build Status
156170
------------
157171
.. image:: https://readthedocs.org/projects/elasticsearch-py/badge/?version=latest&style=flat
158172
:target: https://elasticsearch-py.readthedocs.io/en/master/

docs/async.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Bulk and Streaming Bulk
160160
for word in mywords:
161161
yield {
162162
"_index": "mywords",
163-
"doc": {"word": word},
163+
"word": word,
164164
}
165165
166166
async def main():

docs/helpers.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Helpers
44
=======
55

6-
Collection of simple helper functions that abstract some specifics or the raw
7-
API.
6+
Collection of simple helper functions that abstract some specifics of the raw API.
87

98

109
Bulk helpers
@@ -80,7 +79,7 @@ document is like ``{"word": "<myword>"}``.
8079
for word in mywords:
8180
yield {
8281
"_index": "mywords",
83-
"doc": {"word": word},
82+
"word": word,
8483
}
8584
8685
bulk(es, gendata())

docs/index.rst

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ Official low-level client for Elasticsearch. Its goal is to provide common
55
ground for all Elasticsearch-related code in Python; because of this it tries
66
to be opinion-free and very extendable.
77

8-
For a more high level client library with more limited scope, have a look at
9-
`elasticsearch-dsl`_ - it is a more pythonic library sitting on top of
10-
``elasticsearch-py``.
118

12-
.. _elasticsearch-dsl: https://elasticsearch-dsl.readthedocs.io/
9+
Installation
10+
------------
11+
12+
Install the ``elasticsearch`` package with `pip
13+
<https://pypi.org/project/elasticsearch>`_::
14+
15+
$ python -m pip install elasticsearch
16+
17+
If your application uses async/await in Python you can install with
18+
the ``async`` extra::
19+
20+
$ python -m pip install elasticsearch[async]
21+
22+
Read more about `how to use asyncio with this project <async>`_.
23+
1324

1425
Compatibility
1526
-------------
@@ -47,20 +58,6 @@ The recommended way to set your requirements in your `setup.py` or
4758
If you have a need to have multiple versions installed at the same time older
4859
versions are also released as ``elasticsearch2``, ``elasticsearch5`` and ``elasticsearch6``.
4960

50-
Installation
51-
------------
52-
53-
Install the ``elasticsearch`` package with `pip
54-
<https://pypi.python.org/pypi/elasticsearch>`_::
55-
56-
$ python -m pip install elasticsearch
57-
58-
If your application uses async/await in Python you can install with
59-
the ``async`` extra::
60-
61-
$ python -m pip install elasticsearch[async]
62-
63-
Read more about `how to use asyncio with this project <async>`_.
6461

6562
Example Usage
6663
-------------
@@ -260,7 +257,7 @@ or the port value encoded within ``cloud_id``. Using Cloud ID also disables sni
260257
http_auth=("elastic", "<password>"),
261258
)
262259
263-
APIKey Authentication
260+
API Key Authentication
264261
~~~~~~~~~~~~~~~~~~~~~~
265262

266263
You can configure the client to use Elasticsearch's `API Key`_ for connecting to your cluster.
@@ -374,6 +371,28 @@ However, you can implement your own custom serializer::
374371

375372
.. _JSONSerializer: https://github.com/elastic/elasticsearch-py/blob/master/elasticsearch/serializer.py#L24
376373

374+
375+
Elasticsearch-DSL
376+
-----------------
377+
378+
For a more high level client library with more limited scope, have a look at
379+
`elasticsearch-dsl`_ - a more pythonic library sitting on top of
380+
``elasticsearch-py``.
381+
382+
`elasticsearch-dsl`_ provides a more convenient and idiomatic way to write and manipulate
383+
`queries`_ by mirroring the terminology and structure of Elasticsearch JSON DSL
384+
while exposing the whole range of the DSL from Python
385+
either directly using defined classes or a queryset-like expressions.
386+
387+
It also provides an optional `persistence layer`_ for working with documents as
388+
Python objects in an ORM-like fashion: defining mappings, retrieving and saving
389+
documents, wrapping the document data in user-defined classes.
390+
391+
.. _elasticsearch-dsl: https://elasticsearch-dsl.readthedocs.io/
392+
.. _queries: https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html
393+
.. _persistence layer: https://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html#doctype
394+
395+
377396
Contents
378397
--------
379398

@@ -389,10 +408,11 @@ Contents
389408
helpers
390409
Changelog
391410

411+
392412
License
393413
-------
394414

395-
Copyright 2018 Elasticsearch
415+
Copyright 2020 Elasticsearch B.V
396416

397417
Licensed under the Apache License, Version 2.0 (the "License");
398418
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)