Skip to content

Commit

Permalink
[7.x][DOCS] Adds Configuration section to Python book
Browse files Browse the repository at this point in the history
  • Loading branch information
szabosteve authored Jan 27, 2021
1 parent ca0db1a commit da6629d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/guide/configuration.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[config]]
== Configuration

This page contains information about the most important configuration options of
the Python {es} client.

* <<connection-pool>>
* <<connection-selector>>


include::connection-pool.asciidoc[]
include::connection-selector.asciidoc[]
18 changes: 18 additions & 0 deletions docs/guide/connection-pool.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[connection-pool]]
=== Connection pool

Connection pool is a container that holds the `Connection` instances, manages
the selection process (via a `ConnectionSelector`) and dead connections.

Initially connections are stored in the class as a list and – along with the
connection options – get passed to the `ConnectionSelector` instance for future
reference.

Upon each request, the `Transport` asks for a `Connection` via the
`get_connection` method. If the connection fails, it is marked as dead (via
`mark_dead`) and put on a timeout. When the timeout is over the connection is
resurrected and returned to the live pool. A connection that has been previously
marked as dead and then succeeds is marked as live (its fail count is deleted).

For reference information, refer to the
https://elasticsearch-py.readthedocs.io/en/latest/connection.html#connection-pool[full {es} Python documentation].
20 changes: 20 additions & 0 deletions docs/guide/connection-selector.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[connection-selector]]
=== Connection selector

Connection selector is a simple class used to select a connection from a list of
currently live connection instances. Initially, it is passed a dictionary
containing all the connections options which it can then use during the
selection process. When the _select_ method is called it is given a list of
currently live connections to choose from.

The options dictionary is passed to `Transport` as the hosts parameter and the
same is used to construct the connection object itself. When the connection was
created based on information retrieved from the cluster via the sniffing
process, it is the dictionary returned by the `host_info_callback`.

Example of where this might be useful is a zone-aware selector that would only
select connections from its own zones and only fall back to other connections
where there would be none in its zones.

For reference information, refer to the
https://elasticsearch-py.readthedocs.io/en/latest/connection.html#connection-selector[full {es} Python documentation].
4 changes: 3 additions & 1 deletion docs/guide/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ include::overview.asciidoc[]

include::installation.asciidoc[]

include::connecting.asciidoc[]
include::connecting.asciidoc[]

include::configuration.asciidoc[]

0 comments on commit da6629d

Please sign in to comment.