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.

Tracking Requests with Opaque ID

You can enrich your requests against Elasticsearch with an identifier string, that allows you to discover this identifier in deprecation logs, to support you with identifying search slow log origin or to help with identifying running tasks.

import elasticsearch

# You can add to the client to apply to all requests
client = elasticsearch.Elasticsearch(opaque_id="app17@dc06.eu_user1234")

# Or you can apply per-request for more granularity.
resp = client.get(index="test", id="1", opaque_id="app17@dc06.eu_user1234")

Response Filtering

The filter_path parameter is used to reduce the response returned by elasticsearch. For example, to only return _id and _type, do:

es.search(index='test-index', filter_path=['hits.hits._id', 'hits.hits._type'])

It also supports the * wildcard character to match any field or part of a field’s name:

es.search(index='test-index', filter_path=['hits.hits._*'])

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, ingest, nodes, snapshot and tasks that provide access to instances of CatClient, ClusterClient, IndicesClient, IngestClient, NodesClient, SnapshotClient and TasksClient 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
    verify_certs=True,
    # provide a path to CA certs on disk
    ca_certs='/path/to/CA_certs'
)

If using SSL, but don’t verify the certs, a warning message is showed optionally (see Urllib3HttpConnection for detailed description of the options):

es = Elasticsearch(
    ['localhost:443', 'other_host:443'],
    # turn on SSL
    use_ssl=True,
    # no verify SSL certificates
    verify_certs=False,
    # don't show warnings about ssl certs verification
    ssl_show_warn=False
)

SSL client authentication is supported (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
    verify_certs=True,
    # provide a path to CA certs on disk
    ca_certs='/path/to/CA_certs',
    # PEM formatted SSL client certificate
    client_cert='/path/to/clientcert.pem',
    # PEM formatted SSL client key
    client_key='/path/to/clientkey.pem'
)

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
)

By default, JSONSerializer is used to encode all outgoing requests. However, you can implement your own custom serializer:

from elasticsearch.serializer import JSONSerializer

class SetEncoder(JSONSerializer):
    def default(self, obj):
        if isinstance(obj, set):
            return list(obj)
        if isinstance(obj, Something):
            return 'CustomSomethingRepresentation'
        return JSONSerializer.default(self, obj)

es = Elasticsearch(serializer=SetEncoder())
Parameters:
  • hosts – list of nodes, or a single node, 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 Connection 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(body, index=None, doc_type=None, params=None, headers=None)

Allows to perform multiple index/update/delete operations in a single request. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html

Parameters:
  • body – The operation definition and data (action-data pairs), separated by newlines
  • index – Default index for items which don’t provide one
  • doc_type – Default document type for items which don’t provide one
  • _source – True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub- request
  • _source_excludes – Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
  • _source_includes – Default list of fields to extract and return from the _source field, can be overridden on each sub-request
  • pipeline – The pipeline id to preprocess incoming documents with
  • refresh – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. Valid choices: true, false, wait_for
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
clear_scroll(body=None, scroll_id=None, params=None, headers=None)

Explicitly clears the search context for a scroll. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#_clear_scroll_api

Parameters:
  • body – A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
  • scroll_id – A comma-separated list of scroll IDs to clear
close()

Closes the Transport and all internal connections

count(body=None, index=None, params=None, headers=None)

Returns number of documents matching a query. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html

Parameters:
  • body – A query to restrict the results specified with the Query DSL (optional)
  • index – A comma-separated list of indices to restrict the results
  • 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) Valid choices: AND, OR Default: 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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_throttled – Whether specified concrete, expanded or aliased indices should be ignored when throttled
  • 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
  • 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 – A comma-separated list of specific routing values
  • terminate_after – The maximum count for each shard, upon reaching which the query execution will terminate early
create(index, id, body, doc_type=None, params=None, headers=None)

Creates a new document in the index. Returns a 409 response when a document with a same ID already exists in the index. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html

Parameters:
  • index – The name of the index
  • id – Document ID
  • body – The document
  • doc_type – The type of the document
  • pipeline – The pipeline id to preprocess incoming documents with
  • refresh – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. Valid choices: true, false, wait_for
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
delete(index, id, doc_type=None, params=None, headers=None)

Removes a document from the index. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • doc_type – The type of the document
  • if_primary_term – only perform the delete operation if the last operation that has changed the document has the specified primary term
  • if_seq_no – only perform the delete operation if the last operation that has changed the document has the specified sequence number
  • refresh – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. Valid choices: true, false, wait_for
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
delete_by_query(index, body, params=None, headers=None)

Deletes documents matching the provided query. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-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
  • 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_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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
  • conflicts – What to do when the delete by query hits version conflicts? Valid choices: abort, proceed Default: abort
  • default_operator – The default operator for query string query (AND or OR) Valid choices: AND, OR Default: 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. Valid choices: open, closed, hidden, none, all Default: open
  • from_ – Starting offset (default: 0)
  • 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
  • max_docs – Maximum number of documents to process (default: all documents)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • refresh – Should the affected indexes be refreshed?
  • request_cache – Specify if request cache should be used for this request or not, defaults to index level setting
  • requests_per_second – The throttle for this request in sub- requests per second. -1 means no throttle.
  • 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
  • scroll_size – Size on the scroll request powering the delete by query Default: 100
  • search_timeout – Explicit timeout for each search request. Defaults to no timeout.
  • search_type – Search operation type Valid choices: query_then_fetch, dfs_query_then_fetch
  • slices – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto. Default: 1
  • sort – A comma-separated list of <field>:<direction> pairs
  • stats – Specific ‘tag’ of the request for logging and statistical purposes
  • terminate_after – The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
  • timeout – Time each individual bulk request should wait for shards that are unavailable. Default: 1m
  • version – Specify whether to return document version as part of a hit
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
  • wait_for_completion – Should the request should block until the delete by query is complete. Default: True
delete_by_query_rethrottle(task_id, params=None, headers=None)

Changes the number of requests per second for a particular Delete By Query operation. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html

Parameters:
  • task_id – The task id to rethrottle
  • requests_per_second – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
delete_script(id, params=None, headers=None)

Deletes a script. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html

Parameters:
  • id – Script ID
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
exists(index, id, params=None, headers=None)

Returns information about whether a document exists in an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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
  • stored_fields – A comma-separated list of stored fields to return in the response
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
exists_source(index, id, doc_type=None, params=None, headers=None)

Returns information about whether a document source exists in an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • doc_type – The type of the document; deprecated and optional starting with 7.0
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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 – Specific version type Valid choices: internal, external, external_gte
explain(index, id, body=None, params=None, headers=None)

Returns information about why a specific matches (or doesn’t match) a query. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html

Parameters:
  • index – The name of the index
  • 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_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – 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) Valid choices: AND, OR Default: OR
  • df – The default field for query string query (default: _all)
  • lenient – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
  • 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
  • stored_fields – A comma-separated list of stored fields to return in the response
field_caps(body=None, index=None, params=None, headers=None)

Returns the information about the capabilities of fields among multiple indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html

Parameters:
  • body – An index filter specified with the Query DSL
  • 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. Valid choices: open, closed, hidden, none, all Default: open
  • fields – A comma-separated list of field names
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • include_unmapped – Indicates whether unmapped fields should be included in the response.
get(index, id, params=None, headers=None)

Returns a document. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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
  • stored_fields – A comma-separated list of stored fields to return in the response
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
get_script(id, params=None, headers=None)

Returns a script. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html

Parameters:
  • id – Script ID
  • master_timeout – Specify timeout for connection to master
get_script_context(params=None, headers=None)

Returns all script contexts. https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html

get_script_languages(params=None, headers=None)

Returns available script types, languages and contexts https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html

get_source(index, id, params=None, headers=None)

Returns the source of a document. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html

Parameters:
  • index – The name of the index
  • id – The document ID
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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 – Specific version type Valid choices: internal, external, external_gte
index(index, body, id=None, params=None, headers=None)

Creates or updates a document in an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html

Parameters:
  • index – The name of the index
  • body – The document
  • id – Document ID
  • if_primary_term – only perform the index operation if the last operation that has changed the document has the specified primary term
  • if_seq_no – only perform the index operation if the last operation that has changed the document has the specified sequence number
  • op_type – Explicit operation type. Defaults to index for requests with an explicit document ID, and to `create`for requests without an explicit document ID Valid choices: index, create
  • pipeline – The pipeline id to preprocess incoming documents with
  • refresh – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. Valid choices: true, false, wait_for
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
info(params=None, headers=None)

Returns basic information about the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html

mget(body, index=None, params=None, headers=None)

Allows to get multiple documents in one request. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html

Parameters:
  • body – Document identifiers; can be either docs (containing full document information) or ids (when index is provided in the URL.
  • index – The name of the index
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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
  • stored_fields – A comma-separated list of stored fields to return in the response
msearch(body, index=None, params=None, headers=None)

Allows to execute several search operations in one request. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html

Parameters:
  • body – The request definitions (metadata-search request definition pairs), separated by newlines
  • index – A comma-separated list of index names to use as default
  • ccs_minimize_roundtrips – Indicates whether network round- trips should be minimized as part of cross-cluster search requests execution Default: true
  • max_concurrent_searches – Controls the maximum number of concurrent searches the multi search api will execute
  • max_concurrent_shard_requests – The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests Default: 5
  • pre_filter_shard_size – A threshold that enforces a pre- filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
  • rest_total_hits_as_int – Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • search_type – Search operation type Valid choices: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch
  • typed_keys – Specify whether aggregation and suggester names should be prefixed by their respective types in the response
msearch_template(body, index=None, params=None, headers=None)

Allows to execute several search template operations in one request. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html

Parameters:
  • body – The request definitions (metadata-search request definition pairs), separated by newlines
  • index – A comma-separated list of index names to use as default
  • ccs_minimize_roundtrips – Indicates whether network round- trips should be minimized as part of cross-cluster search requests execution Default: true
  • max_concurrent_searches – Controls the maximum number of concurrent searches the multi search api will execute
  • rest_total_hits_as_int – Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • search_type – Search operation type Valid choices: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch
  • typed_keys – Specify whether aggregation and suggester names should be prefixed by their respective types in the response
mtermvectors(body=None, index=None, params=None, headers=None)

Returns multiple termvectors in one request. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html

Parameters:
  • body – Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
  • index – The index in which the document resides.
  • 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
  • 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”.
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
ping(params=None, headers=None)

Returns whether the cluster is running. https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html

put_script(id, body, context=None, params=None, headers=None)

Creates or updates a script. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html

Parameters:
  • id – Script ID
  • body – The document
  • context – Context name to compile script against
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
rank_eval(body, index=None, params=None, headers=None)

Allows to evaluate the quality of ranked search results over a set of typical search queries https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html

Parameters:
  • body – The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.
  • index – A comma-separated list of index names to search; 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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • search_type – Search operation type Valid choices: query_then_fetch, dfs_query_then_fetch
reindex(body, params=None, headers=None)

Allows to copy documents from one index to another, optionally filtering the source documents by a query, changing the destination index settings, or fetching the documents from a remote cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html

Parameters:
  • body – The search definition using the Query DSL and the prototype for the index request.
  • max_docs – Maximum number of documents to process (default: all documents)
  • refresh – Should the affected indexes be refreshed?
  • requests_per_second – The throttle to set on this request in sub-requests per second. -1 means no throttle.
  • scroll – Control how long to keep the search context alive Default: 5m
  • slices – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto. Default: 1
  • timeout – Time each individual bulk request should wait for shards that are unavailable. Default: 1m
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
  • wait_for_completion – Should the request should block until the reindex is complete. Default: True
reindex_rethrottle(task_id, params=None, headers=None)

Changes the number of requests per second for a particular Reindex operation. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html

Parameters:
  • task_id – The task id to rethrottle
  • requests_per_second – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
render_search_template(body=None, id=None, params=None, headers=None)

Allows to use the Mustache language to pre-render a search definition. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html#_validating_templates

Parameters:
  • body – The search definition template and its params
  • id – The id of the stored search template
scripts_painless_execute(body=None, params=None, headers=None)

Allows an arbitrary script to be executed and a result to be returned https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html

Parameters:body – The script to execute
scroll(body=None, scroll_id=None, params=None, headers=None)

Allows to retrieve a large numbers of results from a single search request. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll

Parameters:
  • body – The scroll ID if not passed by URL or query parameter.
  • scroll_id – The scroll ID for scrolled search
  • rest_total_hits_as_int – Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • scroll – Specify how long a consistent view of the index should be maintained for scrolled search
search(body=None, index=None, params=None, headers=None)

Returns results matching a query. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html

Parameters:
  • body – The search definition using the Query DSL
  • index – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices
  • _source – True or false to return the _source field or not, or a list of fields to return
  • _source_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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)
  • allow_partial_search_results – Indicate if an error should be returned if there is a partial search failure or timeout Default: True
  • analyze_wildcard – Specify whether wildcard and prefix queries should be analyzed (default: false)
  • analyzer – The analyzer to use for the query string
  • batched_reduce_size – The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. Default: 512
  • ccs_minimize_roundtrips – Indicates whether network round- trips should be minimized as part of cross-cluster search requests execution Default: true
  • default_operator – The default operator for query string query (AND or OR) Valid choices: AND, OR Default: OR
  • df – The field to use as default where no field prefix is given in the query string
  • docvalue_fields – A comma-separated list of fields to return as the docvalue representation of a field for each hit
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: open
  • explain – Specify whether to return detailed information about score computation as part of a hit
  • from_ – Starting offset (default: 0)
  • ignore_throttled – Whether specified concrete, expanded or aliased indices should be ignored when throttled
  • 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
  • max_concurrent_shard_requests – The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests Default: 5
  • pre_filter_shard_size – A threshold that enforces a pre- filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • request_cache – Specify if request cache should be used for this request or not, defaults to index level setting
  • rest_total_hits_as_int – Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • 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 Valid choices: query_then_fetch, dfs_query_then_fetch
  • seq_no_primary_term – Specify whether to return sequence number and primary term of the last modification of each hit
  • size – Number of hits to return (default: 10)
  • sort – A comma-separated list of <field>:<direction> pairs
  • stats – Specific ‘tag’ of the request for logging and statistical purposes
  • stored_fields – A comma-separated list of stored fields to return as part of a hit
  • suggest_field – Specify which field to use for suggestions
  • suggest_mode – Specify suggest mode Valid choices: missing, popular, always 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
  • track_total_hits – Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
  • typed_keys – Specify whether aggregation and suggester names should be prefixed by their respective types in the response
  • version – Specify whether to return document version as part of a hit
search_shards(index=None, params=None, headers=None)

Returns information about the indices and shards that a search request would be executed against. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html

Parameters:
  • index – A comma-separated list of index names to search; 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. Valid choices: open, closed, hidden, none, all 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(body, index=None, params=None, headers=None)

Allows to use the Mustache language to pre-render a search definition. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-template.html

Parameters:
  • body – The search definition template and its params
  • index – A comma-separated list of index names to search; 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)
  • ccs_minimize_roundtrips – Indicates whether network round- trips should be minimized as part of cross-cluster search requests execution Default: true
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: open
  • explain – Specify whether to return detailed information about score computation as part of a hit
  • ignore_throttled – Whether specified concrete, expanded or aliased indices should be ignored when throttled
  • 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)
  • profile – Specify whether to profile the query execution
  • rest_total_hits_as_int – Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • 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 Valid choices: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch
  • typed_keys – Specify whether aggregation and suggester names should be prefixed by their respective types in the response
termvectors(index, body=None, id=None, params=None, headers=None)

Returns information and statistics about terms in the fields of a particular document. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html

Parameters:
  • index – The index in which the document resides.
  • body – Define parameters and or supply a document to get termvectors for. See documentation.
  • id – The id of the document, when not specified a doc param should be supplied.
  • 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
  • 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.
  • version – Explicit version number for concurrency control
  • version_type – Specific version type Valid choices: internal, external, external_gte
update(index, id, body, doc_type=None, params=None, headers=None)

Updates a document with a script or partial document. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html

Parameters:
  • index – The name of the index
  • id – Document ID
  • body – The request definition requires either script or partial doc
  • 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_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • if_primary_term – only perform the update operation if the last operation that has changed the document has the specified primary term
  • if_seq_no – only perform the update operation if the last operation that has changed the document has the specified sequence number
  • lang – The script language (default: painless)
  • refresh – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. Valid choices: true, false, wait_for
  • retry_on_conflict – Specify how many times should the operation be retried when a conflict occurs (default: 0)
  • routing – Specific routing value
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
update_by_query(index, body=None, params=None, headers=None)

Performs an update on every document in the index without changing the source, for example to pick up a mapping change. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-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
  • 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_excludes – A list of fields to exclude from the returned _source field
  • _source_includes – A list of fields to extract and return from the _source field
  • 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
  • conflicts – What to do when the update by query hits version conflicts? Valid choices: abort, proceed Default: abort
  • default_operator – The default operator for query string query (AND or OR) Valid choices: AND, OR Default: 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. Valid choices: open, closed, hidden, none, all Default: open
  • from_ – Starting offset (default: 0)
  • 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
  • max_docs – Maximum number of documents to process (default: all documents)
  • pipeline – Ingest pipeline to set on index requests made by this action. (default: none)
  • preference – Specify the node or shard the operation should be performed on (default: random)
  • q – Query in the Lucene query string syntax
  • refresh – Should the affected indexes be refreshed?
  • request_cache – Specify if request cache should be used for this request or not, defaults to index level setting
  • requests_per_second – The throttle to set on this request in sub-requests per second. -1 means no throttle.
  • 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
  • scroll_size – Size on the scroll request powering the update by query Default: 100
  • search_timeout – Explicit timeout for each search request. Defaults to no timeout.
  • search_type – Search operation type Valid choices: query_then_fetch, dfs_query_then_fetch
  • slices – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto. Default: 1
  • sort – A comma-separated list of <field>:<direction> pairs
  • stats – Specific ‘tag’ of the request for logging and statistical purposes
  • terminate_after – The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
  • timeout – Time each individual bulk request should wait for shards that are unavailable. Default: 1m
  • version – Specify whether to return document version as part of a hit
  • version_type – Should the document increment the version number (internal) on hit or not (reindex)
  • wait_for_active_shards – Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
  • wait_for_completion – Should the request should block until the update by query operation is complete. Default: True
update_by_query_rethrottle(task_id, params=None, headers=None)

Changes the number of requests per second for a particular Update By Query operation. https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html

Parameters:
  • task_id – The task id to rethrottle
  • requests_per_second – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

Indices

class elasticsearch.client.IndicesClient(client)
analyze(body=None, index=None, params=None, headers=None)

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

Parameters:
  • body – Define analyzer/tokenizer parameters and the text on which the analysis should be performed
  • index – The name of the index to scope the operation
clear_cache(index=None, params=None, headers=None)

Clears all or specific caches for one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html

Parameters:
  • index – A comma-separated list of index name to limit the operation
  • 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. Valid choices: open, closed, hidden, none, all Default: open
  • fielddata – Clear field data
  • fields – A comma-separated list of fields to clear when using the fielddata parameter (default: all)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • query – Clear query caches
  • request – Clear request cache
clone(index, target, body=None, params=None, headers=None)

Clones an index https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html

Parameters:
  • index – The name of the source index to clone
  • target – The name of the target index to clone into
  • body – The configuration for the target index (settings and aliases)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Set the number of active shards to wait for on the cloned index before the operation returns.
close(index, params=None, headers=None)

Closes an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html

Parameters:
  • index – A comma separated list of indices to close
  • 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. Valid choices: open, closed, hidden, none, all Default: 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
  • wait_for_active_shards – Sets the number of active shards to wait for before the operation returns.
create(index, body=None, params=None, headers=None)

Creates an index with optional settings and mappings. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
  • wait_for_active_shards – Set the number of active shards to wait for before the operation returns.
create_data_stream(name, body=None, params=None, headers=None)

Creates or updates a data stream https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html

Parameters:
  • name – The name of the data stream
  • body – The data stream definition
delete(index, params=None, headers=None)

Deletes an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html

Parameters:
  • index – A comma-separated list of indices to delete; use _all or * string to delete all indices
  • 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) Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Ignore unavailable indexes (default: false)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete_alias(index, name, params=None, headers=None)

Deletes an alias. https://www.elastic.co/guide/en/elasticsearch/reference/master/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_data_stream(name, params=None, headers=None)

Deletes a data stream. https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html

Parameters:name – The name of the data stream
delete_index_template(name, params=None, headers=None)

Deletes an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The name of the template
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete_template(name, params=None, headers=None)

Deletes an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The name of the template
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
exists(index, params=None, headers=None)

Returns information about whether a particular index exists. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html

Parameters:
  • index – A comma-separated list of index names
  • 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) Valid choices: open, closed, hidden, none, all Default: open
  • flat_settings – Return settings in flat format (default: false)
  • ignore_unavailable – Ignore unavailable indexes (default: false)
  • include_defaults – Whether to return all default setting for each of the indices.
  • local – Return local information, do not retrieve the state from master node (default: false)
exists_alias(name, index=None, params=None, headers=None)

Returns information about whether a particular alias exists. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all Default: all
  • 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_index_template(name, params=None, headers=None)

Returns information about whether a particular index template exists. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
exists_template(name, params=None, headers=None)

Returns information about whether a particular index template exists. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The comma separated names of the index templates
  • 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
exists_type(index, doc_type, params=None, headers=None)

Returns information about whether a particular document type exists. (DEPRECATED) https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all 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)
flush(index=None, params=None, headers=None)

Performs the flush operation on one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html

Parameters:
  • index – A comma-separated list of index names; use _all or empty string for 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. Valid choices: open, closed, hidden, none, all Default: open
  • force – Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)
  • 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 true. If set to false the flush will be skipped iff if another flush operation is already running.
forcemerge(index=None, params=None, headers=None)

Performs the force merge operation on one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.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. Valid choices: open, closed, hidden, none, all Default: open
  • flush – Specify whether the index should be flushed after performing the operation (default: true)
  • 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
freeze(index, params=None, headers=None)

Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only. https://www.elastic.co/guide/en/elasticsearch/reference/master/freeze-index-api.html

Parameters:
  • index – The name of the index to freeze
  • 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. Valid choices: open, closed, hidden, none, all Default: closed
  • 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
  • wait_for_active_shards – Sets the number of active shards to wait for before the operation returns.
get(index, params=None, headers=None)

Returns information about one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html

Parameters:
  • index – A comma-separated list of index names
  • 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) Valid choices: open, closed, hidden, none, all Default: open
  • flat_settings – Return settings in flat format (default: false)
  • ignore_unavailable – Ignore unavailable indexes (default: false)
  • include_defaults – Whether to return all default setting for each of the indices.
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Specify timeout for connection to master
get_alias(index=None, name=None, params=None, headers=None)

Returns an alias. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html

Parameters:
  • index – A comma-separated list of index names to filter aliases
  • name – A comma-separated list of alias names to return
  • 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. Valid choices: open, closed, hidden, none, all Default: all
  • 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_data_stream(name=None, params=None, headers=None)

Returns data streams. https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html

Parameters:name – The name or wildcard expression of the requested data streams
get_field_mapping(fields, index=None, params=None, headers=None)

Returns mapping for one or more fields. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html

Parameters:
  • fields – A comma-separated list of fields
  • index – A comma-separated list of index names
  • 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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • include_defaults – Whether the default mapping values should be returned as well
  • local – Return local information, do not retrieve the state from master node (default: false)
get_index_template(name=None, params=None, headers=None)

Returns an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The comma separated names of the index templates
  • 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_mapping(index=None, params=None, headers=None)

Returns mappings for one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html

Parameters:
  • index – A comma-separated list of index names
  • 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. Valid choices: open, closed, hidden, none, all 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)
  • master_timeout – Specify timeout for connection to master
get_settings(index=None, name=None, params=None, headers=None)

Returns settings for one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
  • 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. Valid choices: open, closed, hidden, none, all Default: all
  • flat_settings – Return settings in flat format (default: false)
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • include_defaults – Whether to return all default setting for each of the indices.
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Specify timeout for connection to master
get_template(name=None, params=None, headers=None)

Returns an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The comma separated names of the index templates
  • 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(index=None, params=None, headers=None)

DEPRECATED Returns a progress status of current upgrade. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
open(index, params=None, headers=None)

Opens an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html

Parameters:
  • index – A comma separated list of indices to open
  • 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. Valid choices: open, closed, hidden, none, all Default: closed
  • 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
  • wait_for_active_shards – Sets the number of active shards to wait for before the operation returns.
put_alias(index, name, body=None, params=None, headers=None)

Creates or updates an alias. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html

Parameters:
  • index – A comma-separated list of index names the alias should point to (supports wildcards); use _all 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_index_template(name, body, params=None, headers=None)

Creates or updates an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The name of the template
  • body – The template definition
  • cause – User defined reason for creating/updating the index template
  • create – Whether the index template should only be added if new or can also replace an existing one
  • master_timeout – Specify timeout for connection to master
put_mapping(index, body, params=None, headers=None)

Updates the index mappings. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html

Parameters:
  • index – A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices.
  • body – The mapping 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. Valid choices: open, closed, hidden, none, all Default: 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
put_settings(body, index=None, params=None, headers=None)

Updates the index settings. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all 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)
  • master_timeout – Specify timeout for connection to master
  • preserve_existing – Whether to update existing settings. If set to true existing settings on an index remain unchanged, the default is false
  • timeout – Explicit operation timeout
put_template(name, body, params=None, headers=None)

Creates or updates an index template. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
  • master_timeout – Specify timeout for connection to master
  • order – The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
recovery(index=None, params=None, headers=None)

Returns information about ongoing index shard recoveries. https://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
  • detailed – Whether to display detailed information about shard recovery
refresh(index=None, params=None, headers=None)

Performs the refresh operation in one or more indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
reload_search_analyzers(index, params=None, headers=None)

Reloads an index’s search analyzers and their resources. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html

Parameters:
  • index – A comma-separated list of index names to reload analyzers for
  • 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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
resolve_index(name, params=None, headers=None)

Returns information about any matching indices, aliases, and data streams https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index.html

Parameters:
  • name – A comma-separated list of names or wildcard expressions
  • expand_wildcards – Whether wildcard expressions should get expanded to open or closed indices (default: open) Valid choices: open, closed, hidden, none, all Default: open
rollover(alias, body=None, new_index=None, params=None, headers=None)

Updates an alias to point to a new index when the existing index is considered to be too large or too old. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html

Parameters:
  • alias – The name of the alias to rollover
  • body – The conditions that needs to be met for executing rollover
  • new_index – The name of the rollover index
  • dry_run – If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Set the number of active shards to wait for on the newly created rollover index before the operation returns.
segments(index=None, params=None, headers=None)

Provides low-level information about segments in a Lucene index. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • verbose – Includes detailed memory usage by Lucene.
shard_stores(index=None, params=None, headers=None)

Provides store information for shard copies of indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.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. Valid choices: open, closed, hidden, none, all Default: open
  • ignore_unavailable – Whether specified concrete indices should be ignored when unavailable (missing or closed)
  • status – A comma-separated list of statuses used to filter on shards to get store information for Valid choices: green, yellow, red, all
shrink(index, target, body=None, params=None, headers=None)

Allow to shrink an existing index into a new index with fewer primary shards. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html

Parameters:
  • index – The name of the source index to shrink
  • target – The name of the target index to shrink into
  • body – The configuration for the target index (settings and aliases)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Set the number of active shards to wait for on the shrunken index before the operation returns.
simulate_index_template(name, body=None, params=None, headers=None)

Simulate matching the given index name against the index templates in the system https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • name – The name of the index (it must be a concrete index name)
  • body – New index template definition, which will be included in the simulation, as if it already exists in the system
  • cause – User defined reason for dry-run creating the new template for simulation purposes
  • create – Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one
  • master_timeout – Specify timeout for connection to master
simulate_template(body=None, name=None, params=None, headers=None)

Simulate resolving the given template name or body https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html

Parameters:
  • body – New index template definition to be simulated, if no index template name is specified
  • name – The name of the index template
  • cause – User defined reason for dry-run creating the new template for simulation purposes
  • create – Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one
  • master_timeout – Specify timeout for connection to master
split(index, target, body=None, params=None, headers=None)

Allows you to split an existing index into a new index with more primary shards. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html

Parameters:
  • index – The name of the source index to split
  • target – The name of the target index to split into
  • body – The configuration for the target index (settings and aliases)
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
  • wait_for_active_shards – Set the number of active shards to wait for on the shrunken index before the operation returns.
stats(index=None, metric=None, params=None, headers=None)

Provides statistics on operations happening in an index. https://www.elastic.co/guide/en/elasticsearch/reference/master/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 – Limit the information returned the specific metrics. Valid choices: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest, bulk
  • completion_fields – A comma-separated list of fields for fielddata and suggest index metric (supports wildcards)
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: open
  • 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)
  • forbid_closed_indices – If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices Default: True
  • groups – A comma-separated list of search groups for search index metric
  • include_segment_file_sizes – Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
  • include_unloaded_segments – If set to true segment stats will include stats for segments that are not currently loaded into memory
  • level – Return stats aggregated at cluster, index or shard level Valid choices: cluster, indices, shards Default: indices
  • types – A comma-separated list of document types for the indexing index metric
unfreeze(index, params=None, headers=None)

Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. https://www.elastic.co/guide/en/elasticsearch/reference/master/unfreeze-index-api.html

Parameters:
  • index – The name of the index to unfreeze
  • 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. Valid choices: open, closed, hidden, none, all Default: closed
  • 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
  • wait_for_active_shards – Sets the number of active shards to wait for before the operation returns.
update_aliases(body, params=None, headers=None)

Updates index aliases. https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html

Parameters:
  • body – The definition of actions to perform
  • master_timeout – Specify timeout for connection to master
  • timeout – Request timeout
upgrade(index=None, params=None, headers=None)

DEPRECATED Upgrades to the current version of Lucene. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: open, closed, hidden, none, all Default: 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: false)
validate_query(body=None, index=None, doc_type=None, params=None, headers=None)

Allows a user to validate a potentially expensive query without executing it. https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html

Parameters:
  • body – The query definition specified with the Query DSL
  • 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
  • all_shards – Execute validation on all shards instead of one random shard per index
  • 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) Valid choices: AND, OR Default: 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. Valid choices: open, closed, hidden, none, all Default: 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
  • q – Query in the Lucene query string syntax
  • rewrite – Provide a more detailed explanation showing the actual Lucene query that will be executed.

Ingest

class elasticsearch.client.IngestClient(client)
delete_pipeline(id, params=None, headers=None)

Deletes a pipeline. https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html

Parameters:
  • id – Pipeline ID
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
get_pipeline(id=None, params=None, headers=None)

Returns a pipeline. https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html

Parameters:
  • id – Comma separated list of pipeline ids. Wildcards supported
  • master_timeout – Explicit operation timeout for connection to master node
processor_grok(params=None, headers=None)

Returns a list of the built-in patterns. https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get

put_pipeline(id, body, params=None, headers=None)

Creates or updates a pipeline. https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html

Parameters:
  • id – Pipeline ID
  • body – The ingest definition
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
simulate(body, id=None, params=None, headers=None)

Allows to simulate a pipeline with example documents. https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html

Parameters:
  • body – The simulate definition
  • id – Pipeline ID
  • verbose – Verbose mode. Display data output for each processor in executed pipeline

Cluster

class elasticsearch.client.ClusterClient(client)
allocation_explain(body=None, params=None, headers=None)

Provides explanations for shard allocations in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html

Parameters:
  • body – The index, shard, and primary flag to explain. Empty means ‘explain the first unassigned shard’
  • include_disk_info – Return information about disk usage and shard sizes (default: false)
  • include_yes_decisions – Return ‘YES’ decisions in explanation (default: false)
delete_component_template(name, params=None, headers=None)

Deletes a component template https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html

Parameters:
  • name – The name of the template
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
delete_voting_config_exclusions(params=None, headers=None)

Clears cluster voting config exclusions. https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html

Parameters:wait_for_removal – Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. Default: True
exists_component_template(name, params=None, headers=None)

Returns information about whether a particular component template exist https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.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
get_component_template(name=None, params=None, headers=None)

Returns one or more component templates https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html

Parameters:
  • name – The comma separated names of the component templates
  • 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_settings(params=None, headers=None)

Returns cluster settings. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html

Parameters:
  • flat_settings – Return settings in flat format (default: false)
  • include_defaults – Whether to return all default clusters setting.
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
health(index=None, params=None, headers=None)

Returns basic information about the health of the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html

Parameters:
  • index – Limit the information returned to a specific index
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: all
  • level – Specify the level of detail for returned information Valid choices: cluster, indices, shards Default: 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_events – Wait until all currently queued events with the given priority are processed Valid choices: immediate, urgent, high, normal, low, languid
  • wait_for_no_initializing_shards – Whether to wait until there are no initializing shards in the cluster
  • wait_for_no_relocating_shards – Whether to wait until there are no relocating shards in the cluster
  • wait_for_nodes – Wait until the specified number of nodes is available
  • wait_for_status – Wait until cluster is in a specific state Valid choices: green, yellow, red
pending_tasks(params=None, headers=None)

Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
post_voting_config_exclusions(params=None, headers=None)

Updates the cluster voting config exclusions by node ids or node names. https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html

Parameters:
  • node_ids – A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names.
  • node_names – A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids.
  • timeout – Explicit operation timeout Default: 30s
put_component_template(name, body, params=None, headers=None)

Creates or updates a component template https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.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
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
put_settings(body, params=None, headers=None)

Updates the cluster settings. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
remote_info(params=None, headers=None)

Returns the information about configured remote clusters. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html

reroute(body=None, params=None, headers=None)

Allows to manually change the allocation of individual shards in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
  • master_timeout – Explicit operation timeout for connection to master node
  • metric – Limit the information returned to the specified metrics. Defaults to all but metadata Valid choices: _all, blocks, metadata, nodes, routing_table, master_node, version
  • retry_failed – Retries allocation of shards that are blocked due to too many subsequent allocation failures
  • timeout – Explicit operation timeout
state(metric=None, index=None, params=None, headers=None)

Returns a comprehensive information about the state of the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html

Parameters:
  • metric – Limit the information returned to the specified metrics Valid choices: _all, blocks, metadata, nodes, routing_table, routing_nodes, 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 to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all 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
  • wait_for_metadata_version – Wait for the metadata version to be equal or greater than the specified metadata version
  • wait_for_timeout – The maximum time to wait for wait_for_metadata_version before timing out
stats(node_id=None, params=None, headers=None)

Returns high-level overview of cluster statistics. https://www.elastic.co/guide/en/elasticsearch/reference/master/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)
  • timeout – Explicit operation timeout

Nodes

class elasticsearch.client.NodesClient(client)
hot_threads(node_id=None, params=None, headers=None)

Returns information about hot threads on each node in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
  • doc_type – The type to sample (default: cpu) Valid choices: cpu, wait, block
  • 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)
  • timeout – Explicit operation timeout
info(node_id=None, metric=None, params=None, headers=None)

Returns information about nodes in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/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. Valid choices: settings, os, process, jvm, thread_pool, transport, http, plugins, ingest
  • flat_settings – Return settings in flat format (default: false)
  • timeout – Explicit operation timeout
reload_secure_settings(body=None, node_id=None, params=None, headers=None)

Reloads secure settings. https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings

Parameters:
  • body – An object containing the password for the elasticsearch keystore
  • node_id – A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.
  • timeout – Explicit operation timeout
stats(node_id=None, metric=None, index_metric=None, params=None, headers=None)

Returns statistical information about nodes in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/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 Valid choices: _all, breaker, fs, http, indices, jvm, os, process, thread_pool, transport, discovery
  • 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. Valid choices: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest, bulk
  • 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
  • include_segment_file_sizes – Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
  • level – Return indices stats aggregated at index, node or shard level Valid choices: indices, node, shards Default: node
  • timeout – Explicit operation timeout
  • types – A comma-separated list of document types for the indexing index metric
usage(node_id=None, metric=None, params=None, headers=None)

Returns low-level information about REST actions usage on nodes. https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.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 Valid choices: _all, rest_actions
  • timeout – Explicit operation timeout

Cat

class elasticsearch.client.CatClient(client)
aliases(name=None, params=None, headers=None)

Shows information about currently configured aliases to indices including filter and routing infos. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html

Parameters:
  • name – A comma-separated list of alias names to return
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: all
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
allocation(node_id=None, params=None, headers=None)

Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. https://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 Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
count(index=None, params=None, headers=None)

Provides quick access to the document count of the entire cluster, or individual indices. https://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
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
fielddata(fields=None, params=None, headers=None)

Shows how much heap memory is currently being used by fielddata on every data node in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html

Parameters:
  • fields – A comma-separated list of fields to return in the output
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
health(params=None, headers=None)

Returns a concise representation of the cluster health. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • ts – Set to false to disable timestamping Default: True
  • v – Verbose mode. Display column headers
help(params=None, headers=None)

Returns help for the Cat APIs. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html

Parameters:
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
indices(index=None, params=None, headers=None)

Returns information about indices: number of primaries and replicas, document counts, disk size, … https://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 Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices: open, closed, hidden, none, all Default: all
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • health – A health status (“green”, “yellow”, or “red” to filter only indices matching the specified health status Valid choices: green, yellow, red
  • help – Return help information
  • include_unloaded_segments – If set to true segment stats will include stats for segments that are not currently loaded into memory
  • 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
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
master(params=None, headers=None)

Returns information about the master node. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
ml_data_frame_analytics(id=None, params=None, headers=None)

Gets configuration and usage information about data frame analytics jobs. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-dfanalytics.html

Parameters:
  • id – The ID of the data frame analytics to fetch
  • allow_no_match – Whether to ignore if a wildcard expression matches no configs. (This includes _all string or when no configs have been specified)
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
ml_datafeeds(datafeed_id=None, params=None, headers=None)

Gets configuration and usage information about datafeeds. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-datafeeds.html

Parameters:
  • datafeed_id – The ID of the datafeeds stats to fetch
  • allow_no_datafeeds – Whether to ignore if a wildcard expression matches no datafeeds. (This includes _all string or when no datafeeds have been specified)
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
ml_jobs(job_id=None, params=None, headers=None)

Gets configuration and usage information about anomaly detection jobs. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-anomaly-detectors.html

Parameters:
  • job_id – The ID of the jobs stats to fetch
  • allow_no_jobs – Whether to ignore if a wildcard expression matches no jobs. (This includes _all string or when no jobs have been specified)
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
ml_trained_models(model_id=None, params=None, headers=None)

Gets configuration and usage information about inference trained models. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-trained-model.html

Parameters:
  • model_id – The ID of the trained models stats to fetch
  • allow_no_match – Whether to ignore if a wildcard expression matches no trained models. (This includes _all string or when no trained models have been specified) Default: True
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • from_ – skips a number of trained models
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • size – specifies a max number of trained models to get Default: 100
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
nodeattrs(params=None, headers=None)

Returns information about custom node attributes. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
nodes(params=None, headers=None)

Returns basic statistics about performance of cluster nodes. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html

Parameters:
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • full_id – Return the full node ID instead of the shortened version (default: false)
  • h – Comma-separated list of column names to display
  • help – Return help information
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
pending_tasks(params=None, headers=None)

Returns a concise representation of the cluster pending tasks. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
plugins(params=None, headers=None)

Returns information about installed plugins across nodes node. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
recovery(index=None, params=None, headers=None)

Returns information about index shard recoveries, both on-going completed. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html

Parameters:
  • index – Comma-separated list or wildcard expression of index names to limit the returned information
  • active_only – If true, the response only includes ongoing shard recoveries
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • detailed – If true, the response includes detailed information about shard recoveries
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
repositories(params=None, headers=None)

Returns information about snapshot repositories registered in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html

Parameters:
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
segments(index=None, params=None, headers=None)

Provides low-level information about the segments in the shards of an index. https://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
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
shards(index=None, params=None, headers=None)

Provides a detailed view of shard allocation on nodes. https://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
  • bytes – The unit in which to display byte values Valid choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
snapshots(repository=None, params=None, headers=None)

Returns all snapshots in a specific repository. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html

Parameters:
  • repository – Name of repository from which to fetch the snapshot information
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • ignore_unavailable – Set to true to ignore unavailable snapshots
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
tasks(params=None, headers=None)

Returns information about the tasks currently executing on one or more nodes in the cluster. https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html

Parameters:
  • actions – A comma-separated list of actions that should be returned. Leave empty to return all.
  • detailed – Return detailed task information (default: false)
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • 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
  • parent_task – Return tasks with specified parent task id. Set to -1 to return all.
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
templates(name=None, params=None, headers=None)

Returns information about existing templates. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html

Parameters:
  • name – A pattern that returned template names must match
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • v – Verbose mode. Display column headers
thread_pool(thread_pool_patterns=None, params=None, headers=None)

Returns cluster-wide thread pool statistics per node. By default the active, queue and rejected statistics are returned for all thread pools. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html

Parameters:
  • thread_pool_patterns – A comma-separated list of regular- expressions to filter the thread pools in the output
  • format – a short version of the Accept header, e.g. json, yaml
  • h – Comma-separated list of column names to display
  • help – Return help information
  • local – Return local information, do not retrieve the state from master node (default: false)
  • master_timeout – Explicit operation timeout for connection to master node
  • s – Comma-separated list of column names or column aliases to sort by
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers
transforms(transform_id=None, params=None, headers=None)

Gets configuration and usage information about transforms. https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-transforms.html

Parameters:
  • transform_id – The id of the transform for which to get stats. ‘_all’ or ‘*’ implies all transforms
  • allow_no_match – Whether to ignore if a wildcard expression matches no transforms. (This includes _all string or when no transforms have been specified)
  • format – a short version of the Accept header, e.g. json, yaml
  • from_ – skips a number of transform configs, defaults to 0
  • h – Comma-separated list of column names to display
  • help – Return help information
  • s – Comma-separated list of column names or column aliases to sort by
  • size – specifies a max number of transforms to get, defaults to 100
  • time – The unit in which to display time values Valid choices: d, h, m, s, ms, micros, nanos
  • v – Verbose mode. Display column headers

Snapshot

class elasticsearch.client.SnapshotClient(client)
cleanup_repository(repository, params=None, headers=None)

Removes stale data from repository. https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html

Parameters:
  • repository – A repository name
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
create(repository, snapshot, body=None, params=None, headers=None)

Creates a snapshot in a repository. https://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
create_repository(repository, body, params=None, headers=None)

Creates a repository. https://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
  • verify – Whether to verify the repository after creation
delete(repository, snapshot, params=None, headers=None)

Deletes one or more snapshots. https://www.elastic.co/guide/en/elasticsearch/reference/master/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
delete_repository(repository, params=None, headers=None)

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

Parameters:
  • repository – Name of the snapshot repository to unregister. Wildcard (*) patterns are supported.
  • master_timeout – Explicit operation timeout for connection to master node
  • timeout – Explicit operation timeout
get(repository, snapshot, params=None, headers=None)

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

Parameters:
  • repository – A repository name
  • snapshot – A comma-separated list of snapshot names
  • ignore_unavailable – Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
  • master_timeout – Explicit operation timeout for connection to master node
  • verbose – Whether to show verbose snapshot info or only show the basic info found in the repository index blob
get_repository(repository=None, params=None, headers=None)

Returns information about a repository. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

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

Restores a snapshot. https://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
status(repository=None, snapshot=None, params=None, headers=None)

Returns information about the status of a snapshot. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

Parameters:
  • repository – A repository name
  • snapshot – A comma-separated list of snapshot names
  • ignore_unavailable – Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
  • master_timeout – Explicit operation timeout for connection to master node
verify_repository(repository, params=None, headers=None)

Verifies a repository. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html

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

Tasks

class elasticsearch.client.TasksClient(client)
cancel(task_id=None, params=None, headers=None)

Cancels a task, if it can be cancelled through an API. https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html

Parameters:
  • task_id – Cancel the task with specified task id (node_id:task_number)
  • actions – A comma-separated list of actions that should be cancelled. Leave empty to cancel all.
  • nodes – 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
  • parent_task_id – Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.
  • wait_for_completion – Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false
get(task_id, params=None, headers=None)

Returns information about a task. https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html

Parameters:
  • task_id – Return the task with specified id (node_id:task_number)
  • timeout – Explicit operation timeout
  • wait_for_completion – Wait for the matching tasks to complete (default: false)
list(params=None, headers=None)

Returns a list of tasks. https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html

Parameters:
  • actions – A comma-separated list of actions that should be returned. Leave empty to return all.
  • detailed – Return detailed task information (default: false)
  • group_by – Group tasks by nodes or parent/child relationships Valid choices: nodes, parents, none Default: nodes
  • nodes – 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
  • parent_task_id – Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
  • timeout – Explicit operation timeout
  • wait_for_completion – Wait for the matching tasks to complete (default: false)

Dangling Indices

class elasticsearch.client.DanglingIndicesClient(client)
delete_dangling_index(index_uuid, params=None, headers=None)

Deletes the specified dangling index https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html

Parameters:
  • index_uuid – The UUID of the dangling index
  • accept_data_loss – Must be set to true in order to delete the dangling index
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
import_dangling_index(index_uuid, params=None, headers=None)

Imports the specified dangling index https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html

Parameters:
  • index_uuid – The UUID of the dangling index
  • accept_data_loss – Must be set to true in order to import the dangling index
  • master_timeout – Specify timeout for connection to master
  • timeout – Explicit operation timeout
list_dangling_indices(params=None, headers=None)

Returns all dangling indices. https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html