Skip to content

Commit 8e7293f

Browse files
pquentinleemthompo
andauthored
Fix Sphinx index page (#2373)
* Fix Sphinx index page It failed to provide an URL when instantiating the client, did not link to the Quickstart page and generally use older Python idioms. * Update docs/sphinx/index.rst Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
1 parent 87ae51d commit 8e7293f

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

docs/sphinx/index.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Language clients are forward compatible; meaning that clients support communicat
3333
with greater or equal minor versions of Elasticsearch. Elasticsearch language clients
3434
are only backwards compatible with default distributions and without guarantees made.
3535

36-
If you have a need to have multiple versions installed at the same time older
37-
versions are also released as ``elasticsearch2``, ``elasticsearch5`` and ``elasticsearch6``.
36+
If you need multiple versions installed at the same time, versions are
37+
also released, such as ``elasticsearch7`` and ``elasticsearch8``.
3838

3939

4040
Example Usage
@@ -44,25 +44,28 @@ Example Usage
4444
4545
from datetime import datetime
4646
from elasticsearch import Elasticsearch
47-
es = Elasticsearch()
47+
48+
es = Elasticsearch("http://localhost:9200")
4849
4950
doc = {
50-
'author': 'kimchy',
51-
'text': 'Elasticsearch: cool. bonsai cool.',
52-
'timestamp': datetime.now(),
51+
"author": "kimchy",
52+
"text": "Elasticsearch: cool. bonsai cool.",
53+
"timestamp": datetime.now(),
5354
}
5455
resp = es.index(index="test-index", id=1, document=doc)
55-
print(resp['result'])
56+
print(resp["result"])
5657
5758
resp = es.get(index="test-index", id=1)
58-
print(resp['_source'])
59+
print(resp["_source"])
5960
6061
es.indices.refresh(index="test-index")
6162
6263
resp = es.search(index="test-index", query={"match_all": {}})
63-
print("Got %d Hits:" % resp['hits']['total']['value'])
64-
for hit in resp['hits']['hits']:
65-
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
64+
print("Got {} hits:".format(resp["hits"]["total"]["value"]))
65+
for hit in resp["hits"]["hits"]:
66+
print("{timestamp} {author} {text}".format(**hit["_source"]))
67+
68+
See more examples in the :ref:`quickstart` page.
6669

6770

6871
Interactive examples

docs/sphinx/quickstart.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Quickstart
1+
.. _quickstart:
2+
3+
Quickstart
24
==========
35

46
This guide shows you how to install the Elasticsearch Python client and perform basic

0 commit comments

Comments
 (0)