Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Sphinx index page #2373

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Language clients are forward compatible; meaning that clients support communicat
with greater or equal minor versions of Elasticsearch. Elasticsearch language clients
are only backwards compatible with default distributions and without guarantees made.

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


Example Usage
Expand All @@ -44,25 +44,28 @@ Example Usage

from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()

es = Elasticsearch("http://localhost:9200")

doc = {
'author': 'kimchy',
'text': 'Elasticsearch: cool. bonsai cool.',
'timestamp': datetime.now(),
"author": "kimchy",
"text": "Elasticsearch: cool. bonsai cool.",
"timestamp": datetime.now(),
}
resp = es.index(index="test-index", id=1, document=doc)
print(resp['result'])
print(resp["result"])

resp = es.get(index="test-index", id=1)
print(resp['_source'])
print(resp["_source"])

es.indices.refresh(index="test-index")

resp = es.search(index="test-index", query={"match_all": {}})
print("Got %d Hits:" % resp['hits']['total']['value'])
for hit in resp['hits']['hits']:
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
print("Got {} hits:".format(resp["hits"]["total"]["value"]))
for hit in resp["hits"]["hits"]:
print("{timestamp} {author} {text}".format(**hit["_source"]))

See more examples in the :ref:`quickstart` page.


Interactive examples
Expand Down
4 changes: 3 additions & 1 deletion docs/sphinx/quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Quickstart
.. _quickstart:

Quickstart
==========

This guide shows you how to install the Elasticsearch Python client and perform basic
Expand Down
Loading