Skip to content

Commit 3502e9f

Browse files
committed
[7.14] Cleanup README and unused files
1 parent cc9d3a4 commit 3502e9f

File tree

7 files changed

+74
-112
lines changed

7 files changed

+74
-112
lines changed

.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ omit =
66
*/site-packages/*
77
*.egg/*
88
test_elasticsearch/*
9-
elasticsearch/connection/esthrift/*

AUTHORS

Lines changed: 0 additions & 2 deletions
This file was deleted.

Changelog.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include AUTHORS
2-
include Changelog.rst
31
include CONTRIBUTING.md
42
include LICENSE
53
include MANIFEST.in

Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.rst

Lines changed: 60 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
Python Elasticsearch Client
1+
.. raw:: html
2+
3+
<img align="right" width="auto" height="auto" src="https://www.elastic.co/static-res/images/elastic-logo-200.png">
4+
5+
6+
Elasticsearch Python Client
27
===========================
38

49
.. image:: https://img.shields.io/pypi/v/elasticsearch
510
:target: https://pypi.org/project/elasticsearch
611

12+
.. image:: https://img.shields.io/conda/vn/conda-forge/elasticsearch?color=blue
13+
:target: https://anaconda.org/conda-forge/elasticsearch
14+
715
.. image:: https://pepy.tech/badge/elasticsearch
816
:target: https://pepy.tech/project/elasticsearch?versions=*
917

@@ -13,9 +21,23 @@ Python Elasticsearch Client
1321
.. image:: https://readthedocs.org/projects/elasticsearch-py/badge/?version=latest&style=flat
1422
:target: https://elasticsearch-py.readthedocs.io
1523

16-
Official low-level client for Elasticsearch. Its goal is to provide common
17-
ground for all Elasticsearch-related code in Python; because of this it tries
18-
to be opinion-free and very extendable.
24+
*The official Python client for Elasticsearch.*
25+
26+
27+
Features
28+
--------
29+
30+
* Translating basic Python data types to and from JSON
31+
* Configurable automatic discovery of cluster nodes
32+
* Persistent connections
33+
* Load balancing (with pluggable selection strategy) across available nodes
34+
* Failed connection penalization (time based - failed connections won't be
35+
retried until a timeout is reached)
36+
* Support for TLS and HTTP authentication
37+
* Thread safety across requests
38+
* Pluggable architecture
39+
* Helper functions for idiomatically using APIs together
40+
1941

2042
Installation
2143
------------
@@ -37,101 +59,52 @@ Compatibility
3759
-------------
3860

3961
Language clients are forward compatible; meaning that clients support communicating
40-
with greater minor versions of Elasticsearch.
41-
42-
Elastic language clients are also backwards compatible with lesser supported
43-
minor Elasticsearch versions.
62+
with greater minor versions of Elasticsearch. Elastic language clients are also backwards
63+
compatible with lesser supported minor Elasticsearch versions.
4464

4565
If you have a need to have multiple versions installed at the same time older
4666
versions are also released as ``elasticsearch2`` and ``elasticsearch5``.
4767

4868

49-
Example use
50-
-----------
51-
52-
.. code-block:: python
53-
54-
>>> from datetime import datetime
55-
>>> from elasticsearch import Elasticsearch
56-
57-
# by default we connect to localhost:9200
58-
>>> es = Elasticsearch()
59-
60-
# create an index in elasticsearch, ignore status code 400 (index already exists)
61-
>>> es.indices.create(index='my-index', ignore=400)
62-
{'acknowledged': True, 'shards_acknowledged': True, 'index': 'my-index'}
63-
64-
# datetimes will be serialized
65-
>>> es.index(index="my-index", id=42, body={"any": "data", "timestamp": datetime.now()})
66-
{'_index': 'my-index',
67-
'_type': '_doc',
68-
'_id': '42',
69-
'_version': 1,
70-
'result': 'created',
71-
'_shards': {'total': 2, 'successful': 1, 'failed': 0},
72-
'_seq_no': 0,
73-
'_primary_term': 1}
74-
75-
# but not deserialized
76-
>>> es.get(index="my-index", id=42)['_source']
77-
{'any': 'data', 'timestamp': '2019-05-17T17:28:10.329598'}
69+
Documentation
70+
-------------
7871

79-
Elastic Cloud (and SSL) use-case:
72+
Documentation for the client is `available on elastic.co`_ and `Read the Docs`_.
8073

81-
.. code-block:: python
82-
83-
>>> from elasticsearch import Elasticsearch
84-
>>> es = Elasticsearch(cloud_id="<some_long_cloud_id>", http_auth=('elastic','yourpassword'))
85-
>>> es.info()
74+
.. _available on elastic.co: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html
75+
.. _Read the Docs: https://elasticsearch-py.readthedocs.io
8676

87-
Using SSL Context with a self-signed cert use-case:
77+
Quick Start
78+
-----------
8879

8980
.. code-block:: python
9081
82+
# Import the client from the 'elasticsearch' module
9183
>>> from elasticsearch import Elasticsearch
92-
>>> from ssl import create_default_context
93-
94-
>>> context = create_default_context(cafile="path/to/cafile.pem")
95-
>>> es = Elasticsearch("https://elasticsearch.url:port", ssl_context=context, http_auth=('elastic','yourpassword'))
96-
>>> es.info()
97-
98-
99-
Features
100-
--------
101-
102-
The client's features include:
103-
104-
* translating basic Python data types to and from json (datetimes are not
105-
decoded for performance reasons)
106-
* configurable automatic discovery of cluster nodes
107-
* persistent connections
108-
* load balancing (with pluggable selection strategy) across all available nodes
109-
* failed connection penalization (time based - failed connections won't be
110-
retried until a timeout is reached)
111-
* support for ssl and http authentication
112-
* thread safety
113-
* pluggable architecture
114-
115-
116-
Elasticsearch-DSL
117-
-----------------
118-
119-
For a more high level client library with more limited scope, have a look at
120-
`elasticsearch-dsl`_ - a more pythonic library sitting on top of
121-
``elasticsearch-py``.
122-
123-
`elasticsearch-dsl`_ provides a more convenient and idiomatic way to write and manipulate
124-
`queries`_ by mirroring the terminology and structure of Elasticsearch JSON DSL
125-
while exposing the whole range of the DSL from Python
126-
either directly using defined classes or a queryset-like expressions.
127-
128-
It also provides an optional `persistence layer`_ for working with documents as
129-
Python objects in an ORM-like fashion: defining mappings, retrieving and saving
130-
documents, wrapping the document data in user-defined classes.
131-
132-
.. _elasticsearch-dsl: https://elasticsearch-dsl.readthedocs.io/
133-
.. _queries: https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html
134-
.. _persistence layer: https://elasticsearch-dsl.readthedocs.io/en/latest/persistence.html#doctype
84+
85+
# Instantiate a client instance
86+
>>> client = Elasticsearch("http://localhost:9200")
87+
88+
# Call an API, in this example `info()`
89+
>>> resp = client.info()
90+
91+
# View the result
92+
>>> resp
93+
{
94+
"name" : "instance-name",
95+
"cluster_name" : "cluster-name",
96+
"cluster_uuid" : "cluster-uuid",
97+
"version" : {
98+
"number" : "7.14.0",
99+
...
100+
},
101+
"tagline" : "You know, for Search"
102+
}
103+
104+
105+
You can read more about `configuring the client`_ in the documentation.
106+
107+
.. _configuring the client: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html
135108

136109

137110
License

setup.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,20 @@
3030
).group(1)
3131

3232
with open(join(base_dir, "README.rst")) as f:
33-
long_description = f.read().strip()
33+
# Remove reST raw directive from README as they're not allowed on PyPI
34+
# Those blocks start with a newline and continue until the next newline
35+
mode = None
36+
lines = []
37+
for line in f:
38+
if line.startswith(".. raw::"):
39+
mode = "ignore_nl"
40+
elif line == "\n":
41+
mode = "wait_nl" if mode == "ignore_nl" else None
42+
if mode is None:
43+
lines.append(line)
44+
45+
long_description = "".join(lines)
46+
3447

3548
packages = [
3649
package

0 commit comments

Comments
 (0)