API Documentation

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.

Note

for compatibility with the Python ecosystem we use from_ instead of from and doc_type instead of type as parameter names.

Global options

Some parameters are added by the client itself and can be used in all API calls.

Ignore

An API call is considered successful (and will return a response) if elasticsearch returns a 2XX response. Otherwise an instance of TransportError (or a more specific subclass) will be raised. You can see other exception and error states in 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])

Timeout

Global timeout can be set when constructing the client (see Connection‘s timeout parameter) or on a per-request basis using request_timeout (float value in seconds) as part of any API call, this value will get passed to the perform_request method of the connection class:

# only wait for 1 second, regardless of the client's default
es.cluster.health(wait_for_status='yellow', request_timeout=1)

Note

Some API calls also accept a timeout parameter that is passed to Elasticsearch server. This timeout is internal and doesn’t guarantee that the request will end in the specified time.

Elasticsearch

class elasticsearch.Elasticsearch(hosts=None, transport_class=<class 'elasticsearch.transport.Transport'>, **kwargs)

Elasticsearch low-level client. Provides a straightforward mapping from Python to ES REST endpoints.

The instance has attributes cat, cluster, indices, nodes and snapshot that provide access to instances of CatClient, ClusterClient, IndicesClient, NodesClient and SnapshotClient respectively. This is the preferred (and only supported) way to get access to those classes and their methods.

You can specify your own connection class which should be used by providing the connection_class parameter:

# create connection to localhost using the ThriftConnection
es = Elasticsearch(connection_class=ThriftConnection)

If you want to turn on Sniffing you have several options (described in Transport):

# create connection that will automatically inspect the cluster to get
# the list of active nodes. Start with nodes running on 'esnode1' and
# 'esnode2'
es = Elasticsearch(
    ['esnode1', 'esnode2'],
    # sniff before doing anything
    sniff_on_start=True,
    # refresh nodes after a node fails to respond
    sniff_on_connection_fail=True,
    # and also every 60 seconds
    sniffer_timeout=60
)

Different hosts can have different parameters, use a dictionary per node to specify those:

# connect to localhost directly and another node using SSL on port 443
# and an url_prefix. Note that ``port`` needs to be an int.
es = Elasticsearch([
    {'host': 'localhost'},
    {'host': 'othernode', 'port': 443, 'url_prefix': 'es', 'use_ssl': True},
])

If using SSL, there are several parameters that control how we deal with certificates (see Urllib3HttpConnection for detailed description of the options):

es = Elasticsearch(
    ['localhost:443', 'other_host:443'],
    # turn on SSL
    use_ssl=True,
    # make sure we verify SSL certificates (off by default)
    verify_certs=True,
    # provide a path to CA certs on disk
    ca_certs='/path/to/CA_certs'
)

Alternatively you can use RFC-1738 formatted URLs, as long as they are not in conflict with other options:

es = Elasticsearch(
    [
        'http://user:secret@localhost:9200/',
        'https://user:secret@other_host:443/production'
    ],
    verify_certs=True
)
Parameters:
  • hosts – list of nodes we should connect to. Node should be a dictionary ({“host”: “localhost”, “port”: 9200}), the entire dictionary will be passed to the Connection class as kwargs, or a string in the format of host[:port] which will be translated to a dictionary automatically. If no value is given the Urllib3HttpConnection class defaults will be used.
  • transport_classTransport subclass to use.
  • kwargs – any additional arguments will be passed on to the Transport class and, subsequently, to the Connection instances.
bulk(*args, **kwargs)

Perform many index/delete operations in a single API call. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

See the bulk() helper function for a more friendly API.

Parameters:
  • body – The operation definition and data (action-data pairs), as either a newline separated string, or a sequence of dicts to serialize (one per row).
  • index – Default index for items which don’t provide one
  • doc_type – Default document type for items which don’t provide one
  • consistency – Explicit write consistency setting for the operation
  • refresh – Refresh the index after performing the operation
  • routing – Specific routing value
  • timeout – Explicit operation timeout
clear_scroll(*args, **kwargs)

Clear the scroll request created by specifying the scroll parameter to search. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Parameters:
  • scroll_id – The scroll ID or a list of scroll IDs
  • body – A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
count(*args, **kwargs)

Execute a query and get the number of matches for that query. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html

Parameters:
  • index – A comma-separated list of indices to restrict the results
  • doc_type – A comma-separated list of types to restrict the results
  • body – A query to restrict the results (optional)
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • analyze_wildcard – Specify whether wildcard and prefix queries should be analyzed (default: false)
  • analyzer – The analyzer to use for the query string
  • default_operator – The default operator for query string query (AND or OR), default u’OR’
  • df – The field to use as default where no field prefix is given in the query string
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • min_score – Include only documents with a specific _score value in the result
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • lowercase_expanded_terms – Specify whether query terms should be lowercased
  • min_score – Include only documents with a specific _score value in the result
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • routing – Specific routing value
count_percolate(*args, **kwargs)

The percolator allows to register queries against an index, and then send percolate requests which include a doc, and getting back the queries that match on that doc out of the set of registered queries. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html

Parameters:
  • index – The index of the document being count percolated.
  • doc_type – The type of the document being count percolated.
  • id – Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
  • body – The count percolator request definition using the percolate DSL
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • percolate_index – The index to count percolate the document into. Defaults to index.
  • percolate_type – The type to count percolate document into. Defaults to type.
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • routing – A comma-separated list of specific routing values
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
create(*args, **kwargs)

Adds a typed JSON document in a specific index, making it searchable. Behind the scenes this method calls index(..., op_type=’create’) http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • body – The document
  • id – Specific document ID (when the POST method is used)
  • consistency – Explicit write consistency setting for the operation
  • parent – ID of the parent document
  • percolate – Percolator queries to execute while indexing the document
  • refresh – Refresh the index after performing the operation
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • timestamp – Explicit timestamp for the document
  • ttl – Expiration time for the document
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
delete(*args, **kwargs)

Delete a typed JSON document from a specific index based on its id. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • id – The document ID
  • consistency – Specific write consistency setting for the operation
  • parent – ID of parent document
  • refresh – Refresh the index after performing the operation
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
delete_by_query(*args, **kwargs)

Delete documents from one or more indices and one or more types based on a query. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

Parameters:
  • index – A comma-separated list of indices to restrict the operation; use _all to perform the operation on all indices
  • doc_type – A comma-separated list of types to restrict the operation
  • body – A query to restrict the operation specified with the Query DSL
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • analyzer – The analyzer to use for the query string
  • consistency – Specific write consistency setting for the operation
  • default_operator – The default operator for query string query (AND or OR), default u’OR’
  • df – The field to use as default where no field prefix is given in the query string
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • q – Query in the Lucene query string syntax
  • routing – Specific routing value
  • timeout – Explicit operation timeout
delete_script(*args, **kwargs)

Remove a stored script from elasticsearch. http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Parameters:
  • lang – Script language
  • id – Script ID
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
delete_template(*args, **kwargs)

Delete a search template. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Parameters:
  • id – Template ID
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
exists(*args, **kwargs)

Returns a boolean indicating whether or not given document exists in Elasticsearch. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • doc_type – The type of the document (uses _all by default to fetch the first document matching the ID across all types)
  • parent – The ID of the parent document
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • realtime – Specify whether to perform the operation in realtime or search mode
  • refresh – Refresh the shard containing the document before performing the operation
  • routing – Specific routing value
explain(*args, **kwargs)

The explain api computes a score explanation for a query and a specific document. This can give useful feedback whether a document matches or didn’t match a specific query. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • id – The document ID
  • body – The query definition using the Query DSL
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_exclude – A list of fields to exclude from the returned _source field
  • _source_include – A list of fields to extract and return from the _source field
  • analyze_wildcard – Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)
  • analyzer – The analyzer for the query string query
  • default_operator – The default operator for query string query (AND or OR), (default: OR)
  • df – The default field for query string query (default: _all)
  • fields – A comma-separated list of fields to return in the response
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • lowercase_expanded_terms – Specify whether query terms should be lowercased
  • parent – The ID of the parent document
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • routing – Specific routing value
  • source – The URL-encoded query definition (instead of using the request body)
field_stats(*args, **kwargs)

The field stats api allows one to find statistical properties of a field without executing a search, but looking up measurements that are natively available in the Lucene index. http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-stats.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • fields – A comma-separated list of fields for to get field statistics for (min value, max value, and more)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • level – Defines if field stats should be returned on a per index level or on a cluster wide level, default u’cluster’
get(*args, **kwargs)

Get a typed JSON document from the index based on its id. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • doc_type – The type of the document (uses _all by default to fetch the first document matching the ID across all types)
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_exclude – A list of fields to exclude from the returned _source field
  • _source_include – A list of fields to extract and return from the _source field
  • fields – A comma-separated list of fields to return in the response
  • parent – The ID of the parent document
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • realtime – Specify whether to perform the operation in realtime or search mode
  • refresh – Refresh the shard containing the document before performing the operation
  • routing – Specific routing value
  • version – Explicit version number for concurrency control
  • version_type – Explicit version number for concurrency control
get_script(*args, **kwargs)

Retrieve a script from the API. http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Parameters:
  • lang – Script language
  • id – Script ID
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
get_source(*args, **kwargs)

Get the source of a document by it’s index, type and id. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document (uses _all by default to fetch the first document matching the ID across all types)
  • id – The document ID
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_exclude – A list of fields to exclude from the returned _source field
  • _source_include – A list of fields to extract and return from the _source field
  • parent – The ID of the parent document
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • realtime – Specify whether to perform the operation in realtime or search mode
  • refresh – Refresh the shard containing the document before performing the operation
  • routing – Specific routing value
  • version – Explicit version number for concurrency control
  • version_type – Explicit version number for concurrency control
get_template(*args, **kwargs)

Retrieve a search template. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Parameters:
  • id – Template ID
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
index(*args, **kwargs)

Adds or updates a typed JSON document in a specific index, making it searchable. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • body – The document
  • id – Document ID
  • consistency – Explicit write consistency setting for the operation
  • op_type – Explicit operation type (default: index)
  • parent – ID of the parent document
  • refresh – Refresh the index after performing the operation
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • timestamp – Explicit timestamp for the document
  • ttl – Expiration time for the document
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
info(*args, **kwargs)

Get the basic info from the current cluster.

mget(*args, **kwargs)

Get multiple documents based on an index, type (optional) and ids. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html

Parameters:
  • body – Document identifiers; can be either docs (containing full document information) or ids (when index and type is provided in the URL.
  • index – The name of the index
  • doc_type – The type of the document
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_exclude – A list of fields to exclude from the returned _source field
  • _source_include – A list of fields to extract and return from the _source field
  • fields – A comma-separated list of fields to return in the response
  • parent – The ID of the parent document
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • realtime – Specify whether to perform the operation in realtime or search mode
  • refresh – Refresh the shard containing the document before performing the operation
  • routing – Specific routing value
mlt(*args, **kwargs)

Get documents that are “like” a specified document. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-more-like-this.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document (use _all to fetch the first document matching the ID across all types)
  • id – The document ID
  • body – A specific search request definition
  • boost_terms – The boost factor
  • include – Whether to include the queried document from the response
  • max_doc_freq – The word occurrence frequency as count: words with higher occurrence in the corpus will be ignored
  • max_query_terms – The maximum query terms to be included in the generated query
  • max_word_length – The minimum length of the word: longer words will be ignored
  • min_doc_freq – The word occurrence frequency as count: words with lower occurrence in the corpus will be ignored
  • min_term_freq – The term frequency as percent: terms with lower occurence in the source document will be ignored
  • min_word_length – The minimum length of the word: shorter words will be ignored
  • mlt_fields – Specific fields to perform the query against
  • percent_terms_to_match – How many terms have to match in order to consider the document a match (default: 0.3)
  • routing – Specific routing value
  • search_from – The offset from which to return results
  • search_indices – A comma-separated list of indices to perform the query against (default: the index containing the document)
  • search_query_hint – The search query hint
  • search_scroll – A scroll search request definition
  • search_size – The number of documents to return (default: 10)
  • search_source – A specific search request definition (instead of using the request body)
  • search_type – Specific search type (eg. dfs_then_fetch, count, etc)
  • search_types – A comma-separated list of types to perform the query against (default: the same type as the document)
  • stop_words – A list of stop words to be ignored
mpercolate(*args, **kwargs)

The percolator allows to register queries against an index, and then send percolate requests which include a doc, and getting back the queries that match on that doc out of the set of registered queries. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html

Parameters:
  • index – The index of the document being count percolated to use as default
  • doc_type – The type of the document being percolated to use as default.
  • body – The percolate request definitions (header & body pair), separated by newlines
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
msearch(*args, **kwargs)

Execute several search requests within the same API. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html

Parameters:
  • body – The request definitions (metadata-search request definition pairs), as either a newline separated string, or a sequence of dicts to serialize (one per row).
  • index – A comma-separated list of index names to use as default
  • doc_type – A comma-separated list of document types to use as default
  • search_type – Search operation type
mtermvectors(*args, **kwargs)

Multi termvectors API allows to get multiple termvectors based on an index, type and id. http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html

Parameters:
  • index – The index in which the document resides.
  • doc_type – The type of the document.
  • body – Define ids, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
  • field_statistics – Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”., default True
  • fields – A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body “params” or “docs”.
  • ids – A comma-separated list of documents ids. You must define ids as parameter or set “ids” or “docs” in the request body
  • offsets – Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”., default True
  • parent – Parent id of documents. Applies to all returned documents unless otherwise specified in body “params” or “docs”.
  • payloads – Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”., default True
  • positions – Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”., default True
  • preference – Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body “params” or “docs”.
  • realtime – Specifies if requests are real-time as opposed to near- real-time (default: true).
  • routing – Specific routing value. Applies to all returned documents unless otherwise specified in body “params” or “docs”.
  • term_statistics – Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”., default False
percolate(*args, **kwargs)

The percolator allows to register queries against an index, and then send percolate requests which include a doc, and getting back the queries that match on that doc out of the set of registered queries. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html

Parameters:
  • index – The index of the document being percolated.
  • doc_type – The type of the document being percolated.
  • id – Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
  • body – The percolator request definition using the percolate DSL
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • percolate_format – Return an array of matching query IDs instead of objects
  • percolate_index – The index to percolate the document into. Defaults to index.
  • percolate_preference – Which shard to prefer when executing the percolate request.
  • percolate_routing – The routing value to use when percolating the existing document.
  • percolate_type – The type to percolate document into. Defaults to type.
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • routing – A comma-separated list of specific routing values
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
ping(*args, **kwargs)

Returns True if the cluster is up, False otherwise.

put_script(*args, **kwargs)

Create a script in given language with specified ID. http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

Parameters:
  • lang – Script language
  • id – Script ID
  • body – The document
  • op_type – Explicit operation type, default u’index’
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
put_template(*args, **kwargs)

Create a search template. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

Parameters:
  • id – Template ID
  • body – The document
  • op_type – Explicit operation type, default u’index’
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
scroll(*args, **kwargs)

Scroll a search request created by specifying the scroll parameter. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

Parameters:
  • scroll_id – The scroll ID
  • body – The scroll ID if not passed by URL or query parameter
  • scroll – Specify how long a consistent view of the index should be maintained for scrolled search
search(*args, **kwargs)

Execute a search query and get back search hits that match the query. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

Parameters:
  • index – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices
  • doc_type – A comma-separated list of document types to search; leave empty to perform the operation on all types
  • body – The search definition using the Query DSL
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_exclude – A list of fields to exclude from the returned _source field
  • _source_include – A list of fields to extract and return from the _source field
  • analyze_wildcard – Specify whether wildcard and prefix queries should be analyzed (default: false)
  • analyzer – The analyzer to use for the query string
  • default_operator – The default operator for query string query (AND or OR) (default: OR)
  • df – The field to use as default where no field prefix is given in the query string
  • explain – Specify whether to return detailed information about score computation as part of a hit
  • fielddata_fields – A comma-separated list of fields to return as the field data representation of a field for each hit
  • fields – A comma-separated list of fields to return as part of a hit
  • indices_boost – Comma-separated list of index boosts
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • lowercase_expanded_terms – Specify whether query terms should be lowercased
  • from_ – Starting offset (default: 0)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • query_cache – Enable or disable caching on a per-query basis
  • routing – A comma-separated list of specific routing values
  • scroll – Specify how long a consistent view of the index should be maintained for scrolled search
  • search_type – Search operation type
  • size – Number of hits to return (default: 10)
  • sort – A comma-separated list of <field>:<direction> pairs
  • source – The URL-encoded request definition using the Query DSL (instead of using request body)
  • stats – Specific ‘tag’ of the request for logging and statistical purposes
  • suggest_field – Specify which field to use for suggestions
  • suggest_mode – Specify suggest mode (default: missing)
  • suggest_size – How many suggestions to return in response
  • suggest_text – The source text for which the suggestions should be returned
  • terminate_after – The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
  • timeout – Explicit operation timeout
  • track_scores – Whether to calculate and return scores even if they are not used for sorting
  • version – Specify whether to return document version as part of a hit
search_exists(*args, **kwargs)

The exists API allows to easily determine if any matching documents exist for a provided query. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-exists.html

Parameters:
  • index – A comma-separated list of indices to restrict the results
  • doc_type – A comma-separated list of types to restrict the results
  • body – A query to restrict the results specified with the Query DSL (optional)
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • analyze_wildcard – Specify whether wildcard and prefix queries should be analyzed (default: false)
  • analyzer – The analyzer to use for the query string
  • default_operator – The default operator for query string query (AND or OR), default u’OR’
  • df – The field to use as default where no field prefix is given in the query string
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • lowercase_expanded_terms – Specify whether query terms should be lowercased
  • min_score – Include only documents with a specific _score value in the result
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • routing – Specific routing value
search_shards(*args, **kwargs)

The search shards api returns the indices and shards that a search request would be executed against. This can give useful feedback for working out issues or planning optimizations with routing and shard preferences. http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. (default: ‘“open”’)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • routing – Specific routing value
search_template(*args, **kwargs)

A query that accepts a query template and a map of key/value pairs to fill in template parameters. http://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-template-query.html

Parameters:
  • index – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices
  • doc_type – A comma-separated list of document types to search; leave empty to perform the operation on all types
  • body – The search definition template and its params
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • routing – A comma-separated list of specific routing values
  • scroll – Specify how long a consistent view of the index should be maintained for scrolled search
  • search_type – Search operation type
suggest(*args, **kwargs)

The suggest feature suggests similar looking terms based on a provided text by using a suggester. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

Parameters:
  • index – A comma-separated list of index names to restrict the operation; use _all or empty string to perform the operation on all indices
  • body – The request definition
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default ‘open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • routing – Specific routing value
termvector(*args, **kwargs)

Returns information and statistics on terms in the fields of a particular document. The document could be stored in the index or artificially provided by the user (Added in 1.4). Note that for documents stored in the index, this is a near realtime API as the term vectors are not available until the next refresh. <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html>

Parameters:
  • index – The index in which the document resides.
  • doc_type – The type of the document.
  • id – The id of the document, when not specified a doc param should be supplied.
  • body – Define parameters and or supply a document to get termvectors for. See documentation.
  • dfs – Specifies if distributed frequencies should be returned instead shard frequencies., default False
  • field_statistics – Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned., default True
  • fields – A comma-separated list of fields to return.
  • offsets – Specifies if term offsets should be returned., default True
  • parent – Parent id of documents.
  • payloads – Specifies if term payloads should be returned., default True
  • positions – Specifies if term positions should be returned., default True
  • preference – Specify the node or shard the operation should be performed on (default: random).
  • realtime – Specifies if request is real-time as opposed to near- real-time (default: true).
  • routing – Specific routing value.
  • term_statistics – Specifies if total term frequency and document frequency should be returned., default False
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
termvectors(*args, **kwargs)

Returns information and statistics on terms in the fields of a particular document. The document could be stored in the index or artificially provided by the user (Added in 1.4). Note that for documents stored in the index, this is a near realtime API as the term vectors are not available until the next refresh. <http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html>

Parameters:
  • index – The index in which the document resides.
  • doc_type – The type of the document.
  • id – The id of the document, when not specified a doc param should be supplied.
  • body – Define parameters and or supply a document to get termvectors for. See documentation.
  • dfs – Specifies if distributed frequencies should be returned instead shard frequencies., default False
  • field_statistics – Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned., default True
  • fields – A comma-separated list of fields to return.
  • offsets – Specifies if term offsets should be returned., default True
  • parent – Parent id of documents.
  • payloads – Specifies if term payloads should be returned., default True
  • positions – Specifies if term positions should be returned., default True
  • preference – Specify the node or shard the operation should be performed on (default: random).
  • realtime – Specifies if request is real-time as opposed to near- real-time (default: true).
  • routing – Specific routing value.
  • term_statistics – Specifies if total term frequency and document frequency should be returned., default False
  • version – Explicit version number for concurrency control
  • version_type – Specific version type
update(*args, **kwargs)

Update a document based on a script or partial data provided. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html

Parameters:
  • index – The name of the index
  • doc_type – The type of the document
  • id – Document ID
  • body – The request definition using either script or partial doc
  • consistency – Explicit write consistency setting for the operation
  • fields – A comma-separated list of fields to return in the response
  • lang – The script language (default: mvel)
  • parent – ID of the parent document
  • refresh – Refresh the index after performing the operation
  • retry_on_conflict – Specify how many times should the operation be retried when a conflict occurs (default: 0)
  • routing – Specific routing value
  • script – The URL-encoded script definition (instead of using request body)
  • script_id – The id of a stored script
  • scripted_upsert – True if the script referenced in script or script_id should be called to perform inserts - defaults to false
  • timeout – Explicit operation timeout
  • timestamp – Explicit timestamp for the document
  • ttl – Expiration time for the document
  • version – Explicit version number for concurrency control
  • version_type – Explicit version number for concurrency control

Indices

class elasticsearch.client.IndicesClient(client)
analyze(*args, **kwargs)

Perform the analysis process on a text and return the tokens breakdown of the text. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html

Parameters:
  • index – The name of the index to scope the operation
  • body – The text on which the analysis should be performed
  • analyzer – The name of the analyzer to use
  • char_filters – A comma-separated list of character filters to use for the analysis
  • field – Use the analyzer configured for this field (instead of passing the analyzer name)
  • filters – A comma-separated list of filters to use for the analysis
  • format – Format of the output, default u’detailed’
  • prefer_local – With true, specify that a local shard should be used if available, with false, use a random shard (default: true)
  • text – The text on which the analysis should be performed (when request body is not used)
  • tokenizer – The name of the tokenizer to use for the analysis
clear_cache(*args, **kwargs)

Clear either all caches or specific cached associated with one ore more indices. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html

Parameters:
  • index – A comma-separated list of index name to limit the operation
  • field_data – Clear field data
  • fielddata – Clear field data
  • fields – A comma-separated list of fields to clear when using the field_data parameter (default: all)
  • filter – Clear filter caches
  • filter_cache – Clear filter caches
  • filter_keys – A comma-separated list of keys to clear when using the filter_cache parameter (default: all)
  • id – Clear ID caches for parent/child
  • id_cache – Clear ID caches for parent/child
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones (default: none)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • query_cache – Clear query cache
  • recycler – Clear the recycler cache
close(*args, **kwargs)

Close an index to remove it’s overhead from the cluster. Closed index is blocked for read/write operations. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html

Parameters:
  • index – A comma-separated list of indices to close; use _all or ‘*’ to close all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
create(*args, **kwargs)

Create an index in Elasticsearch. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

Parameters:
  • index – The name of the index
  • body – The configuration for the index (settings and mappings)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete(*args, **kwargs)

Delete an index in Elasticsearch http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

Parameters:
  • index – A comma-separated list of indices to delete; use _all or ‘*’ to delete all indices
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete_alias(*args, **kwargs)

Delete specific alias. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • index – A comma-separated list of index names (supports wildcards); use _all for all indices
  • name – A comma-separated list of aliases to delete (supports wildcards); use _all to delete all aliases for the specified indices.
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit timestamp for the document
delete_mapping(*args, **kwargs)

Delete a mapping (type) along with its data. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-mapping.html

Parameters:
  • index – A comma-separated list of index names (supports wildcard); use _all for all indices
  • doc_type – A comma-separated list of document types to delete (supports wildcards); use _all to delete all document types in the specified indices.
  • master_timeout – Specify timeout for connection to master
delete_template(*args, **kwargs)

Delete an index template by its name. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

Parameters:
  • name – The name of the template
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete_warmer(*args, **kwargs)

Delete an index warmer. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-warmers.html

Parameters:
  • index – A comma-separated list of index names to delete warmers from (supports wildcards); use _all to perform the operation on all indices.
  • name – A comma-separated list of warmer names to delete (supports wildcards); use _all to delete all warmers in the specified indices.
  • master_timeout – Specify timeout for connection to master
exists(*args, **kwargs)

Return a boolean indicating whether given index exists. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html

Parameters:
  • index – A list of indices to check
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
exists_alias(*args, **kwargs)

Return a boolean indicating whether given alias exists. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • name – A comma-separated list of alias names to return
  • index – A comma-separated list of index names to filter aliases
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones (default: none)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
exists_template(*args, **kwargs)

Return a boolean indicating whether given template exists. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

Parameters:
  • name – The name of the template
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
exists_type(*args, **kwargs)

Check if a type/types exists in an index/indices. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html

Parameters:
  • index – A comma-separated list of index names; use _all to check the types across all indices
  • doc_type – A comma-separated list of document types to check
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones (default: none)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
flush(*args, **kwargs)

Explicitly flush one or more indices. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string for all indices
  • force – Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index.
  • full – If set to true a new index writer is created and settings that have been changed related to the index writer will be refreshed.
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones (default: none)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • wait_if_ongoing – If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is false and will cause an exception to be thrown on the shard level if another flush operation is already running.
flush_synced(*args, **kwargs)

Perform a normal flush, then add a generated unique marker (sync_id) to all shards. https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html

Parameters:index – A comma-separated list of index names; use _all or empty string for all indices
get(*args, **kwargs)

The get index API allows to retrieve information about one or more indexes. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html

Parameters:
  • index – A comma-separated list of index names
  • feature – A comma-separated list of features
  • allow_no_indices – Ignore if a wildcard expression resolves to no concrete indices (default: false)
  • expand_wildcards – Whether wildcard expressions should get expanded to open or closed indices (default: open)
  • ignore_unavailable – Ignore unavailable indexes (default: false)
  • local – Return local information, do not retrieve the state from master node (default: false)
get_alias(*args, **kwargs)

Retrieve a specified alias. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • name – A comma-separated list of alias names to return
  • index – A comma-separated list of index names to filter aliases
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
get_aliases(*args, **kwargs)

Retrieve specified aliases http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • index – A comma-separated list of index names to filter aliases
  • name – A comma-separated list of alias names to filter
  • local – Return local information, do not retrieve the state from master node (default: false)
  • timeout – Explicit operation timeout
get_field_mapping(*args, **kwargs)

Retrieve mapping definition of a specific field. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string for all indices
  • doc_type – A comma-separated list of document types
  • field – A comma-separated list of fields to retrieve the mapping for
  • include_defaults – A boolean indicating whether to return default values
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
get_mapping(*args, **kwargs)

Retrieve mapping definition of index or index/type. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string for all indices
  • doc_type – A comma-separated list of document types
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
get_settings(*args, **kwargs)

Retrieve settings for one or more (or all) indices. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • name – The name of the settings that should be included
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • flat_settings – Return settings in flat format (default: false)
  • local – Return local information, do not retrieve the state from master node (default: false)
get_template(*args, **kwargs)

Retrieve an index template by its name. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

Parameters:
  • name – The name of the template
  • flat_settings – Return settings in flat format (default: false)
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
get_upgrade(*args, **kwargs)

Monitor how much of one or more index is upgraded. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • human – Whether to return time and byte values in human-readable format., default False
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
get_warmer(*args, **kwargs)

Retreieve an index warmer. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-warmers.html

Parameters:
  • index – A comma-separated list of index names to restrict the operation; use _all to perform the operation on all indices
  • doc_type – A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types
  • name – The name of the warmer (supports wildcards); leave empty to get all warmers
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
open(*args, **kwargs)

Open a closed index to make it available for search. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html

Parameters:
  • index – The name of the index
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
optimize(*args, **kwargs)

Explicitly optimize one or more indices through an API. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-optimize.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • flush – Specify whether the index should be flushed after performing the operation (default: true)
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • max_num_segments – The number of segments the index should be merged into (default: dynamic)
  • only_expunge_deletes – Specify whether the operation should only expunge deleted documents
  • operation_threading – TODO: ?
  • wait_for_merge – Specify whether the request should block until the merge process is finished (default: true)
put_alias(*args, **kwargs)

Create an alias for a specific index/indices. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • index – A comma-separated list of index names the alias should point to (supports wildcards); use _all or omit to perform the operation on all indices.
  • name – The name of the alias to be created or updated
  • body – The settings for the alias, such as routing or filter
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit timestamp for the document
put_mapping(*args, **kwargs)

Register specific mapping definition for a specific type. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html

Parameters:
  • doc_type – The name of the document type
  • body – The mapping definition
  • index – A list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices.
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_conflicts – Specify whether to ignore conflicts while updating the mapping (default: false)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
put_settings(*args, **kwargs)

Change specific index level settings in real time. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html

Parameters:
  • body – The index settings to be updated
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • flat_settings – Return settings in flat format (default: false)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • master_timeout – Specify timeout for connection to master
put_template(*args, **kwargs)

Create an index template that will automatically be applied to new indices created. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

Parameters:
  • name – The name of the template
  • body – The template definition
  • create – Whether the index template should only be added if new or can also replace an existing one
  • order – The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • flat_settings – Return settings in flat format (default: false)
put_warmer(*args, **kwargs)

Create an index warmer to run registered search requests to warm up the index before it is available for search. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-warmers.html

Parameters:
  • name – The name of the warmer
  • body – The search request definition for the warmer (query, filters, facets, sorting, etc)
  • index – A comma-separated list of index names to register the warmer for; use _all or omit to perform the operation on all indices
  • doc_type – A comma-separated list of document types to register the warmer for; leave empty to perform the operation on all types
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices in the search request to warm. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both, in the search request to warm., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed) in the search request to warm
  • master_timeout – Specify timeout for connection to master
recovery(*args, **kwargs)

The indices recovery API provides insight into on-going shard recoveries. Recovery status may be reported for specific indices, or cluster-wide. http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • active_only – Display only those recoveries that are currently on- going (default: ‘false’)
  • detailed – Whether to display detailed information about shard recovery (default: ‘false’)
  • human – Whether to return time and byte values in human-readable format. (default: ‘false’)
refresh(*args, **kwargs)

Explicitly refresh one or more index, making all operations performed since the last refresh available for search. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • force – Force a refresh even if not required
segments(*args, **kwargs)

Provide low level segments information that a Lucene index (shard level) is built with. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-segments.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • human – Whether to return time and byte values in human-readable format (default: false)
stats(*args, **kwargs)

Retrieve statistics on different operations happening on an index. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • metric – A comma-separated list of metrics to display. Possible values: “_all”, “completion”, “docs”, “fielddata”, “filter_cache”, “flush”, “get”, “id_cache”, “indexing”, “merge”, “percolate”, “refresh”, “search”, “segments”, “store”, “warmer”
  • completion_fields – A comma-separated list of fields for completion metric (supports wildcards)
  • fielddata_fields – A comma-separated list of fields for fielddata metric (supports wildcards)
  • fields – A comma-separated list of fields for fielddata and completion metric (supports wildcards)
  • groups – A comma-separated list of search groups for search statistics
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones (default: none)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • human – Whether to return time and byte values in human-readable format.
  • level – Return stats aggregated at cluster, index or shard level. (“cluster”, “indices” or “shards”, default: “indices”)
  • types – A comma-separated list of document types for the indexing index metric
status(*args, **kwargs)

Get a comprehensive status information of one or more indices. http://elastic.co/guide/reference/api/admin-indices-_/

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both.
  • ignore_indices – When performed on multiple indices, allows to ignore missing ones, default u’none’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • operation_threading – TODO: ?
  • recovery – Return information about shard recovery
  • snapshot – TODO: ?
  • human – Whether to return time and byte values in human-readable format.
update_aliases(*args, **kwargs)

Update specified aliases. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

Parameters:
  • body – The definition of actions to perform
  • master_timeout – Specify timeout for connection to master
  • timeout – Request timeout
upgrade(*args, **kwargs)

Upgrade one or more indices to the latest format through an API. http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • only_ancient_segments – If true, only ancient (an older Lucene major release) segments will be upgraded
  • wait_for_completion – Specify whether the request should block until the all segments are upgraded (default: true)
validate_query(*args, **kwargs)

Validate a potentially expensive query without executing it. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html

Parameters:
  • index – A comma-separated list of index names to restrict the operation; use _all or empty string to perform the operation on all indices
  • doc_type – A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types
  • body – The query definition specified with the Query DSL
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • analyze_wildcard – Specify whether wildcard and prefix queries should be analyzed (default: false)
  • analyzer – The analyzer to use for the query string
  • default_operator – The default operator for query string query (AND or OR), default u’OR’
  • df – The field to use as default where no field prefix is given in the query string
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both., default u’open’
  • explain – Return detailed information about the error
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • lowercase_expanded_terms – Specify whether query terms should be lowercased
  • operation_threading – TODO: ?
  • q – Query in the Lucene query string syntax

Cluster

class elasticsearch.client.ClusterClient(client)
get_settings(*args, **kwargs)

Get cluster settings. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html

Parameters:
  • flat_settings – Return settings in flat format (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
health(*args, **kwargs)

Get a very simple status on the health of the cluster. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html

Parameters:
  • index – Limit the information returned to a specific index
  • level – Specify the level of detail for returned information, default u’cluster’
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Wait until the specified number of shards is active
  • wait_for_nodes – Wait until the specified number of nodes is available
  • wait_for_relocating_shards – Wait until the specified number of relocating shards is finished
  • wait_for_status – Wait until cluster is in a specific state, default None
pending_tasks(*args, **kwargs)

The pending cluster tasks API returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html

Parameters:
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Specify timeout for connection to master
put_settings(*args, **kwargs)

Update cluster wide specific settings. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html

Parameters:
  • body – The settings to be updated. Can be either transient or persistent (survives cluster restart).
  • flat_settings – Return settings in flat format (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
reroute(*args, **kwargs)

Explicitly execute a cluster reroute allocation command including specific commands. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html

Parameters:
  • body – The definition of commands to perform (move, cancel, allocate)
  • dry_run – Simulate the operation only and return the resulting state
  • explain – Return an explanation of why the commands can or cannot be executed
  • filter_metadata – Don’t return cluster state metadata (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • metric – Limit the information returned to the specified metrics. Defaults to all but metadata
  • timeout – Explicit operation timeout
state(*args, **kwargs)

Get a comprehensive state information of the whole cluster. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html

Parameters:
  • metric – Limit the information returned to the specified metrics. Possible values: “_all”, “blocks”, “index_templates”, “metadata”, “nodes”, “routing_table”, “master_node”, “version”
  • index – A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • allow_no_indices – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)
  • expand_wildcards – Whether wildcard expressions should get expanded to open or closed indices (default: open)
  • flat_settings – Return settings in flat format (default: false)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Specify timeout for connection to master
stats(*args, **kwargs)

The Cluster Stats API allows to retrieve statistics from a cluster wide perspective. The API returns basic index metrics and information about the current nodes that form the cluster. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes
  • flat_settings – Return settings in flat format (default: false)
  • human – Whether to return time and byte values in human-readable format.

Nodes

class elasticsearch.client.NodesClient(client)
hot_threads(*args, **kwargs)

An API allowing to get the current hot threads on each node in the cluster. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes
  • type – The type to sample (default: cpu)
  • ignore_idle_threads – Don’t show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true)
  • interval – The interval for the second sampling of threads
  • snapshots – Number of samples of thread stacktrace (default: 10)
  • threads – Specify the number of threads to provide information for (default: 3)
info(*args, **kwargs)

The cluster nodes info API allows to retrieve one or more (or all) of the cluster nodes information. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes
  • metric – A comma-separated list of metrics you wish returned. Leave empty to return all. Choices are “settings”, “os”, “process”, “jvm”, “thread_pool”, “network”, “transport”, “http”, “plugin”
  • flat_settings – Return settings in flat format (default: false)
  • human – Whether to return time and byte values in human-readable format., default False
shutdown(*args, **kwargs)

The nodes shutdown API allows to shutdown one or more (or all) nodes in the cluster. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to perform the operation on; use _local to perform the operation on the node you’re connected to, leave empty to perform the operation on all nodes
  • delay – Set the delay for the operation (default: 1s)
  • exit – Exit the JVM as well (default: true)
stats(*args, **kwargs)

The cluster nodes stats API allows to retrieve one or more (or all) of the cluster nodes statistics. http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes
  • metric – Limit the information returned to the specified metrics. Possible options are: “_all”, “breaker”, “fs”, “http”, “indices”, “jvm”, “network”, “os”, “process”, “thread_pool”, “transport”
  • index_metric – Limit the information returned for indices metric to the specific index metrics. Isn’t used if indices (or all) metric isn’t specified. Possible options are: “_all”, “completion”, “docs”, “fielddata”, “filter_cache”, “flush”, “get”, “id_cache”, “indexing”, “merge”, “percolate”, “refresh”, “search”, “segments”, “store”, “warmer”
  • completion_fields – A comma-separated list of fields for fielddata and suggest index metric (supports wildcards)
  • fielddata_fields – A comma-separated list of fields for fielddata index metric (supports wildcards)
  • fields – A comma-separated list of fields for fielddata and completion index metric (supports wildcards)
  • groups – A comma-separated list of search groups for search index metric
  • human – Whether to return time and byte values in human-readable format., default False
  • level – Return indices stats aggregated at node, index or shard level, default ‘node’
  • types – A comma-separated list of document types for the indexing index metric

Cat

class elasticsearch.client.CatClient(client)
aliases(*args, **kwargs)

http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html

Parameters:
  • name – A comma-separated list of alias names to return
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
allocation(*args, **kwargs)

Allocation provides a snapshot of how shards have located around the cluster and the state of disk usage. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html

Parameters:
  • node_id – A comma-separated list of node IDs or names to limit the returned information
  • bytes – The unit in which to display byte values
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
count(*args, **kwargs)

Count provides quick access to the document count of the entire cluster, or individual indices. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html

Parameters:
  • index – A comma-separated list of index names to limit the returned information
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
fielddata(*args, **kwargs)

Shows information about currently loaded fielddata on a per-node basis. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html

Parameters:
  • fields – A comma-separated list of fields to return the fielddata size
  • bytes – The unit in which to display byte values
  • fields – A comma-separated list of fields to return the fielddata size
  • h – Comma-separated list of column names to display
  • help – Return help information (default: ‘false’)
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers (default: ‘false’)
health(*args, **kwargs)

health is a terse, one-line representation of the same information from health() API http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html

Parameters:
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • ts – Set to false to disable timestamping, default True
  • v – Verbose mode. Display column headers, default False
help(*args, **kwargs)

A simple help for the cat api. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html

Parameters:help – Return help information, default False
indices(*args, **kwargs)

The indices command provides a cross-section of each index. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html

Parameters:
  • index – A comma-separated list of index names to limit the returned information
  • bytes – The unit in which to display byte values
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • pri – Set to true to return stats only for primary shards, default False
  • v – Verbose mode. Display column headers, default False
master(*args, **kwargs)

Displays the master’s node ID, bound IP address, and node name. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html

Parameters:
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
nodes(*args, **kwargs)

The nodes command shows the cluster topology. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html

Parameters:
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
pending_tasks(*args, **kwargs)

pending_tasks provides the same information as the pending_tasks() API in a convenient tabular format. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html

Parameters:
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
plugins(*args, **kwargs)

http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-plugins.html

Parameters:
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
recovery(*args, **kwargs)

recovery is a view of shard replication. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html

Parameters:
  • index – A comma-separated list of index names to limit the returned information
  • bytes – The unit in which to display byte values
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
segments(*args, **kwargs)

The segments command is the detailed view of Lucene segments per index. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html

Parameters:
  • index – A comma-separated list of index names to limit the returned information
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
shards(*args, **kwargs)

The shards command is the detailed view of what nodes contain which shards. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html

Parameters:
  • index – A comma-separated list of index names to limit the returned information
  • h – Comma-separated list of column names to display
  • help – Return help information, default False
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers, default False
thread_pool(*args, **kwargs)

Get information about thread pools. http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html

Parameters:
  • full_id – Enables displaying the complete node ids (default: ‘false’)
  • h – Comma-separated list of column names to display
  • help – Return help information (default: ‘false’)
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • v – Verbose mode. Display column headers (default: ‘false’)

Snapshot —

class elasticsearch.client.SnapshotClient(client)
create(*args, **kwargs)

Create a snapshot in repository http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A repository name
  • snapshot – A snapshot name
  • body – The snapshot definition
  • master_timeout – Explicit operation timeout for connection to master node
  • wait_for_completion – Should this request wait until the operation has completed before returning, default False
create_repository(*args, **kwargs)

Registers a shared file system repository. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A repository name
  • body – The repository definition
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
delete(*args, **kwargs)

Deletes a snapshot from a repository. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A repository name
  • snapshot – A snapshot name
  • master_timeout – Explicit operation timeout for connection to master node
delete_repository(*args, **kwargs)

Removes a shared file system repository. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A comma-separated list of repository names
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
get(*args, **kwargs)

Retrieve information about a snapshot. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A comma-separated list of repository names
  • snapshot – A comma-separated list of snapshot names
  • master_timeout – Explicit operation timeout for connection to master node
get_repository(*args, **kwargs)

Return information about registered repositories. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A comma-separated list of repository names
  • master_timeout – Explicit operation timeout for connection to master node
  • local – Return local information, do not retrieve the state from master node (default: false)
restore(*args, **kwargs)

Restore a snapshot. http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A repository name
  • snapshot – A snapshot name
  • body – Details of what to restore
  • master_timeout – Explicit operation timeout for connection to master node
  • wait_for_completion – Should this request wait until the operation has completed before returning, default False
status(*args, **kwargs)

Return information about all currently running snapshots. By specifying a repository name, it’s possible to limit the results to a particular repository. http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

Parameters:
  • repository – A repository name
  • snapshot – A comma-separated list of snapshot names
  • master_timeout – Explicit operation timeout for connection to master node
verify_repository(*args, **kwargs)

Returns a list of nodes where repository was successfully verified or an error message if verification process failed. http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

Parameters:
  • repository – A repository name
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout

Table Of Contents

Previous topic

Python Elasticsearch Client

Next topic

Exceptions

This Page