2013-10-10 13:20:42 +02:00
|
|
|
.. _api:
|
|
|
|
|
|
2013-05-12 21:11:01 +02:00
|
|
|
API Documentation
|
|
|
|
|
=================
|
|
|
|
|
|
2014-03-08 18:50:36 +01:00
|
|
|
All the API calls map the raw REST api as closely as possible, including the
|
|
|
|
|
distinction between required and optional arguments to the calls. This means
|
|
|
|
|
that the code makes distinction between positional and keyword arguments; we,
|
|
|
|
|
however, recommend that people *use keyword arguments for all calls for
|
|
|
|
|
consistency and safety*.
|
|
|
|
|
|
|
|
|
|
An API call is considered successful (and will return a response) if
|
|
|
|
|
elasticsearch returns a 2XX response. Otherwise an instance of
|
|
|
|
|
:class:`~elasticsearch.TransportError` (or a more specific subclass) will be
|
2014-03-10 16:25:07 +01:00
|
|
|
raised. You can see other exception and error states in :ref:`exceptions`. If
|
|
|
|
|
you do not wish an exception to be raised you can always pass in an ``ignore``
|
|
|
|
|
parameter with either a single status code that should be ignored or a list of
|
|
|
|
|
them::
|
|
|
|
|
|
|
|
|
|
from elasticsearch import Elasticsearch
|
|
|
|
|
es = Elasticsearch()
|
|
|
|
|
|
|
|
|
|
# ignore 400 cause by IndexAlreadyExistsException when creating an index
|
|
|
|
|
es.indices.create(index='test-index', ignore=400)
|
|
|
|
|
|
|
|
|
|
# ignore 404 and 400
|
|
|
|
|
es.indices.delete(index='test-index', ignore=[400, 404])
|
2013-09-24 16:58:37 +02:00
|
|
|
|
2013-10-17 21:58:53 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
for compatibility with the Python ecosystem we use ``from_`` instead of
|
|
|
|
|
``from`` and ``doc_type`` instead of ``type`` as parameter names.
|
|
|
|
|
|
2013-05-12 21:11:01 +02:00
|
|
|
.. py:module:: elasticsearch
|
|
|
|
|
|
2013-09-07 05:39:39 +10:00
|
|
|
Elasticsearch
|
|
|
|
|
-------------
|
|
|
|
|
|
2013-05-12 21:11:01 +02:00
|
|
|
.. autoclass:: Elasticsearch
|
2013-05-19 18:26:10 +02:00
|
|
|
:members:
|
2013-05-12 21:11:01 +02:00
|
|
|
|
2013-09-07 05:39:39 +10:00
|
|
|
.. py:module:: elasticsearch.client
|
2013-05-12 21:11:01 +02:00
|
|
|
|
2013-09-07 05:39:39 +10:00
|
|
|
Indices
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
.. autoclass:: IndicesClient
|
2013-05-19 18:26:10 +02:00
|
|
|
:members:
|
2013-05-12 21:11:01 +02:00
|
|
|
|
2013-09-07 05:39:39 +10:00
|
|
|
Cluster
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
.. autoclass:: ClusterClient
|
2013-05-19 18:26:10 +02:00
|
|
|
:members:
|
2013-05-12 21:11:01 +02:00
|
|
|
|
2014-01-18 01:16:29 +01:00
|
|
|
Nodes
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
|
.. autoclass:: NodesClient
|
|
|
|
|
:members:
|
|
|
|
|
|
2014-01-18 01:30:31 +01:00
|
|
|
Cat
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
.. autoclass:: CatClient
|
|
|
|
|
:members:
|
|
|
|
|
|
2014-01-18 01:31:17 +01:00
|
|
|
Snapshot
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
.. autoclass:: SnapshotClient
|
|
|
|
|
:members:
|
|
|
|
|
|