@@ -10,12 +10,16 @@ Installation
1010------------
1111
1212Install the ``elasticsearch `` package with `pip
13- <https://pypi.org/project/elasticsearch> `_::
13+ <https://pypi.org/project/elasticsearch> `_:
14+
15+ .. code-block :: console
1416
1517 $ python -m pip install elasticsearch
1618
1719 If your application uses async/await in Python you can install with
18- the ``async `` extra::
20+ the ``async `` extra:
21+
22+ .. code-block :: console
1923
2024 $ python -m pip install elasticsearch[async]
2125
@@ -41,7 +45,9 @@ For **Elasticsearch 2.0** and later, use the major version 2 (``2.x.y``) of the
4145library, and so on.
4246
4347The recommended way to set your requirements in your `setup.py ` or
44- `requirements.txt ` is::
48+ `requirements.txt ` is:
49+
50+ .. code-block :: python
4551
4652 # Elasticsearch 7.x
4753 elasticsearch>= 7.0 .0,< 8.0 .0
@@ -62,7 +68,7 @@ versions are also released as ``elasticsearch2``, ``elasticsearch5`` and ``elast
6268Example Usage
6369-------------
6470
65- ::
71+ .. code-block :: python
6672
6773 from datetime import datetime
6874 from elasticsearch import Elasticsearch
@@ -177,7 +183,9 @@ location.
177183
178184By default we allow ``urllib3 `` to open up to 10 connections to each node, if
179185your application calls for more parallelism, use the ``maxsize `` parameter to
180- raise the limit::
186+ raise the limit:
187+
188+ .. code-block :: python
181189
182190 # allow up to 25 connections to each node
183191 es = Elasticsearch([" host1" , " host2" ], maxsize = 25 )
@@ -194,7 +202,9 @@ SSL and Authentication
194202~~~~~~~~~~~~~~~~~~~~~~
195203
196204You can configure the client to use ``SSL `` for connecting to your
197- elasticsearch cluster, including certificate verification and HTTP auth::
205+ elasticsearch cluster, including certificate verification and HTTP auth:
206+
207+ .. code-block :: python
198208
199209 from elasticsearch import Elasticsearch
200210
@@ -310,7 +320,9 @@ your configuration this might be something you don't want or break completely.
310320In some environments (notably on Google App Engine) your HTTP requests might be
311321restricted so that ``GET `` requests won't accept body. In that case use the
312322``send_get_body_as `` parameter of :class: `~elasticsearch.Transport ` to send all
313- bodies via post::
323+ bodies via post:
324+
325+ .. code-block :: python
314326
315327 from elasticsearch import Elasticsearch
316328 es = Elasticsearch(send_get_body_as = ' POST' )
@@ -320,7 +332,8 @@ Compression
320332When using capacity-constrained networks (low throughput), it may be handy to enable
321333compression. This is especially useful when doing bulk loads or inserting large
322334documents. This will configure compression.
323- ::
335+
336+ .. code-block :: python
324337
325338 from elasticsearch import Elasticsearch
326339 es = Elasticsearch(hosts, http_compress = True )
@@ -331,7 +344,9 @@ Running on AWS with IAM
331344~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332345
333346If you want to use this client with IAM based authentication on AWS you can use
334- the `requests-aws4auth `_ package::
347+ the `requests-aws4auth `_ package:
348+
349+ .. code-block :: python
335350
336351 from elasticsearch import Elasticsearch, RequestsHttpConnection
337352 from requests_aws4auth import AWS4Auth
@@ -357,7 +372,9 @@ Custom serializers
357372~~~~~~~~~~~~~~~~~~
358373
359374By default, `JSONSerializer `_ is used to encode all outgoing requests.
360- However, you can implement your own custom serializer::
375+ However, you can implement your own custom serializer
376+
377+ .. code-block :: python
361378
362379 from elasticsearch.serializer import JSONSerializer
363380
0 commit comments