Repository: elastic/elasticsearch-py

Issue:
.xpack.sql not wired in
the `SqlClient` is not wired into the `xpack` namespace. It is also missing from the docs.

Discussion:

Patch:
diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py
index 55f10bc4..d6e4ba48 100644
--- a/elasticsearch/client/__init__.py
+++ b/elasticsearch/client/__init__.py
@@ -329,6 +329,11 @@ class Elasticsearch(object):
         :arg index: The name of the index
         :arg body: The document
         :arg id: Document ID
+        :arg if_primary_term: only perform the index operation if the last
+            operation that has changed the document has the specified primary
+            term
+        :arg if_seq_no: only perform the index operation if the last operation
+            that has changed the document has the specified sequence number
         :arg doc_type: Document type, defaults to `_doc`. Not used on ES 7 clusters.
         :arg op_type: Explicit operation type, default 'index', valid choices
             are: 'index', 'create'
@@ -356,10 +361,7 @@ class Elasticsearch(object):
             if param in SKIP_IN_PATH:
                 raise ValueError("Empty value passed for a required argument.")
         return self.transport.perform_request(
-            "POST" if id in SKIP_IN_PATH else "PUT",
-            _make_path(index, doc_type, id),
-            params=params,
-            body=body,
+            "POST", _make_path(index, doc_type, id), params=params, body=body
         )
 
     @query_params(
@@ -672,6 +674,7 @@ class Elasticsearch(object):
         "analyze_wildcard",
         "analyzer",
         "batched_reduce_size",
+        "ccs_minimize_roundtrips",
         "default_operator",
         "df",
         "docvalue_fields",
@@ -736,6 +739,9 @@ class Elasticsearch(object):
             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
+        :arg ccs_minimize_roundtrips: Indicates whether network round-trips
+            should be minimized as part of cross-cluster search requests
+            execution, default 'true'
         :arg default_operator: The default operator for query string query (AND
             or OR), default 'OR', valid choices are: 'AND', 'OR'
         :arg df: The field to use as default where no field prefix is given in
@@ -935,10 +941,28 @@ class Elasticsearch(object):
             "POST", _make_path(index, "_update_by_query"), params=params, body=body
         )
 
+    @query_params("requests_per_second")
+    def update_by_query_rethrottle(self, task_id, params=None):
+        """
+        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html>`_
+
+        :arg task_id: The task id to rethrottle
+        :arg requests_per_second: The throttle to set on this request in
+            floating sub-requests per second. -1 means set no throttle.
+        """
+        if task_id in SKIP_IN_PATH:
+            raise ValueError("Empty value passed for a required argument 'task_id'.")
+        return self.transport.perform_request(
+            "POST",
+            _make_path("_update_by_query", task_id, "_rethrottle"),
+            params=params,
+        )
+
     @query_params(
         "refresh",
         "requests_per_second",
         "slices",
+        "scroll",
         "timeout",
         "wait_for_active_shards",
         "wait_for_completion",
@@ -956,6 +980,8 @@ class Elasticsearch(object):
         :arg slices: The number of slices this task should be divided into.
             Defaults to 1 meaning the task isn't sliced into subtasks., default
             1
+        :arg scroll: Control how long to keep the search context alive, default
+            '5m'
         :arg timeout: Time each individual bulk request should wait for shards
             that are unavailable., default '1m'
         :arg wait_for_active_shards: Sets the number of shard copies that must
@@ -1104,6 +1130,23 @@ class Elasticsearch(object):
             "POST", _make_path(index, "_delete_by_query"), params=params, body=body
         )
 
+    @query_params("requests_per_second")
+    def delete_by_query_rethrottle(self, task_id, params=None):
+        """
+        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>`_
+
+        :arg task_id: The task id to rethrottle
+        :arg requests_per_second: The throttle to set on this request in
+            floating sub-requests per second. -1 means set no throttle.
+        """
+        if task_id in SKIP_IN_PATH:
+            raise ValueError("Empty value passed for a required argument 'task_id'.")
+        return self.transport.perform_request(
+            "POST",
+            _make_path("_delete_by_query", task_id, "_rethrottle"),
+            params=params,
+        )
+
     @query_params(
         "allow_no_indices",
         "expand_wildcards",
@@ -1142,12 +1185,14 @@ class Elasticsearch(object):
 
     @query_params(
         "allow_no_indices",
+        "ccs_minimize_roundtrips",
         "expand_wildcards",
         "explain",
         "ignore_unavailable",
         "preference",
         "profile",
         "routing",
+        "rest_total_hits_as_int",
         "scroll",
         "search_type",
         "typed_keys",
@@ -1165,6 +1210,9 @@ class Elasticsearch(object):
         :arg 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)
+        :arg ccs_minimize_roundtrips: Indicates whether network round-trips
+            should be minimized as part of cross-cluster search requests
+            execution, default 'true'
         :arg expand_wildcards: Whether to expand wildcard expression to concrete
             indices that are open, closed or both., default 'open', valid
             choices are: 'open', 'closed', 'none', 'all'
@@ -1176,6 +1224,9 @@ class Elasticsearch(object):
             performed on (default: random)
         :arg profile: Specify whether to profile the query execution
         :arg routing: A comma-separated list of specific routing values
+        :arg rest_total_hits_as_int: Indicates whether hits.total should be
+            rendered as an integer or an object in the rest search response,
+            default False
         :arg scroll: Specify how long a consistent view of the index should be
             maintained for scrolled search
         :arg search_type: Search operation type, valid choices are:
@@ -1244,8 +1295,8 @@ class Elasticsearch(object):
             "GET", _make_path(index, doc_type, id, "_explain"), params=params, body=body
         )
 
-    @query_params("scroll", "rest_total_hits_as_int")
-    def scroll(self, scroll_id=None, body=None, params=None):
+    @query_params("scroll", "rest_total_hits_as_int", "scroll_id")
+    def scroll(self, body=None, params=None):
         """
         Scroll a search request created by specifying the scroll parameter.
         `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_
@@ -1258,12 +1309,6 @@ class Elasticsearch(object):
             in the response. This param is added version 6.x to handle mixed cluster queries where nodes
             are in multiple versions (7.0 and 6.latest)
         """
-        if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
-            raise ValueError("You need to supply scroll_id or body.")
-        elif scroll_id and not body:
-            body = {"scroll_id": scroll_id}
-        elif scroll_id:
-            params["scroll_id"] = scroll_id
 
         return self.transport.perform_request(
             "GET", "/_search/scroll", params=params, body=body
@@ -1309,6 +1354,11 @@ class Elasticsearch(object):
 
         :arg index: The name of the index
         :arg id: The document ID
+        :arg if_primary_term: only perform the delete operation if the last
+            operation that has changed the document has the specified primary
+            term
+        :arg if_seq_no: only perform the delete operation if the last operation
+            that has changed the document has the specified sequence number
         :arg parent: ID of parent document
         :arg refresh: If `true` then refresh the effected shards to make this
             operation visible to search, if `wait_for` then wait for a refresh
@@ -1341,6 +1391,7 @@ class Elasticsearch(object):
         "df",
         "expand_wildcards",
         "ignore_unavailable",
+        "ignore_throttled",
         "lenient",
         "min_score",
         "preference",
@@ -1372,6 +1423,8 @@ class Elasticsearch(object):
             choices are: 'open', 'closed', 'none', 'all'
         :arg ignore_unavailable: Whether specified concrete indices should be
             ignored when unavailable (missing or closed)
+        :arg ignore_throttled: Whether specified concrete, expanded or aliased
+            indices should be ignored when throttled
         :arg lenient: Specify whether format-based query failures (such as
             providing text to a numeric field) should be ignored
         :arg min_score: Include only documents with a specific `_score` value in
@@ -1446,6 +1499,7 @@ class Elasticsearch(object):
         )
 
     @query_params(
+        "ccs_minimize_roundtrips",
         "max_concurrent_searches",
         "max_concurrent_shard_requests",
         "pre_filter_shard_size",
@@ -1462,6 +1516,9 @@ class Elasticsearch(object):
             pairs), separated by newlines
         :arg index: A list of index names, or a string containing a
             comma-separated list of index names, to use as the default
+        :arg ccs_minimize_roundtrips: Indicates whether network round-trips
+            should be minimized as part of cross-cluster search requests
+            execution, default 'true'
         :arg max_concurrent_searches: Controls the maximum number of concurrent
             searches the multi search api will execute
         :arg pre_filter_shard_size: A threshold that enforces a pre-filter
@@ -1614,7 +1671,7 @@ class Elasticsearch(object):
             body=body,
         )
 
-    @query_params()
+    @query_params("master_timeout", "timeout")
     def put_script(self, id, body, context=None, params=None):
         """
         Create a script in given language with specified ID.
@@ -1622,7 +1679,9 @@ class Elasticsearch(object):
 
         :arg id: Script ID
         :arg body: The document
-        """
+        :arg master_timeout: Specify timeout for connection to master
+	:arg timeout: Explicit operation timeout
+	"""
         for param in (id, body):
             if param in SKIP_IN_PATH:
                 raise ValueError("Empty value passed for a required argument.")
@@ -1630,13 +1689,38 @@ class Elasticsearch(object):
             "PUT", _make_path("_scripts", id, context), params=params, body=body
         )
 
-    @query_params()
+    @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
+    def rank_eval(self, body, index=None, params=None):
+        """
+        `<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html>`_
+
+        :arg body: The ranking evaluation search definition, including search
+            requests, document ratings and ranking metric definition.
+        :arg index: A comma-separated list of index names to search; use `_all`
+            or empty string to perform the operation on all indices
+        :arg 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)
+        :arg expand_wildcards: Whether to expand wildcard expression to concrete
+            indices that are open, closed or both., default 'open', valid
+            choices are: 'open', 'closed', 'none', 'all'
+        :arg ignore_unavailable: Whether specified concrete indices should be
+            ignored when unavailable (missing or closed)
+        """
+        if body in SKIP_IN_PATH:
+            raise ValueError("Empty value passed for a required argument 'body'.")
+        return self.transport.perform_request(
+            "GET", _make_path(index, "_rank_eval"), params=params, body=body
+        )
+
+    @query_params("master_timeout")
     def get_script(self, id, params=None):
         """
         Retrieve a script from the API.
         `<http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html>`_
 
         :arg id: Script ID
+        :arg master_timeout: Specify timeout for connection to master
         """
         if id in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'id'.")
@@ -1644,14 +1728,15 @@ class Elasticsearch(object):
             "GET", _make_path("_scripts", id), params=params
         )
 
-    @query_params()
+    @query_params("master_timeout", "timeout")
     def delete_script(self, id, params=None):
         """
         Remove a stored script from elasticsearch.
         `<http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html>`_
 
         :arg id: Script ID
-        """
+        :arg master_timeout: Specify timeout for connection to master
+        :arg timeout: Explicit operation timeout        """
         if id in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'id'.")
         return self.transport.perform_request(
@@ -1670,7 +1755,35 @@ class Elasticsearch(object):
             "GET", _make_path("_render", "template", id), params=params, body=body
         )
 
-    @query_params("max_concurrent_searches", "search_type", "typed_keys")
+    @query_params("context")
+    def scripts_painless_context(self, params=None):
+        """
+        `<>`_
+
+        :arg context: Select a specific context to retrieve API information
+            about
+        """
+        return self.transport.perform_request(
+            "GET", "/_scripts/painless/_context", params=params
+        )
+
+    @query_params()
+    def scripts_painless_execute(self, body=None, params=None):
+        """
+        `<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
+
+        :arg body: The script to execute
+        """
+        return self.transport.perform_request(
+            "GET", "/_scripts/painless/_execute", params=params, body=body
+        )
+
+    @query_params(
+        "ccs_minimize_roundtrips",
+        "max_concurrent_searches",
+        "search_type",
+        "typed_keys",
+    )
     def msearch_template(self, body, index=None, params=None):
         """
         The /_search/template endpoint allows to use the mustache language to
@@ -1682,6 +1795,9 @@ class Elasticsearch(object):
             pairs), separated by newlines
         :arg index: A list of index names, or a string containing a
             comma-separated list of index names, to use as the default
+        :arg ccs_minimize_roundtrips: Indicates whether network round-trips
+            should be minimized as part of cross-cluster search requests
+            execution, default 'true'
         :arg max_concurrent_searches: Controls the maximum number of concurrent
             searches the multi search api will execute
         :arg search_type: Search operation type, valid choices are:
@@ -1701,7 +1817,11 @@ class Elasticsearch(object):
         )
 
     @query_params(
-        "allow_no_indices", "expand_wildcards", "fields", "ignore_unavailable"
+        "allow_no_indices",
+        "expand_wildcards",
+        "fields",
+        "ignore_unavailable",
+        "include_unmapped",
     )
     def field_caps(self, index=None, body=None, params=None):
         """
@@ -1721,6 +1841,8 @@ class Elasticsearch(object):
         :arg fields: A comma-separated list of field names
         :arg ignore_unavailable: Whether specified concrete indices should be
             ignored when unavailable (missing or closed)
+        :arg include_unmapped: Indicates whether unmapped fields should be
+            included in the response., default False
         """
         return self.transport.perform_request(
             "GET", _make_path(index, "_field_caps"), params=params, body=body
diff --git a/elasticsearch/client/cat.py b/elasticsearch/client/cat.py
index f20d8af4..46ac8e8b 100644
--- a/elasticsearch/client/cat.py
+++ b/elasticsearch/client/cat.py
@@ -24,9 +24,7 @@ class CatClient(NamespacedClient):
             "GET", _make_path("_cat", "aliases", name), params=params
         )
 
-    @query_params(
-        "bytes", "size", "format", "h", "help", "local", "master_timeout", "s", "v"
-    )
+    @query_params("bytes", "format", "h", "help", "local", "master_timeout", "s", "v")
     def allocation(self, node_id=None, params=None):
         """
         Allocation provides a snapshot of how shards have located around the
@@ -52,7 +50,7 @@ class CatClient(NamespacedClient):
             "GET", _make_path("_cat", "allocation", node_id), params=params
         )
 
-    @query_params("size", "format", "h", "help", "local", "master_timeout", "s", "v")
+    @query_params("format", "h", "help", "local", "master_timeout", "s", "v")
     def count(self, index=None, params=None):
         """
         Count provides quick access to the document count of the entire cluster,
@@ -111,7 +109,6 @@ class CatClient(NamespacedClient):
 
     @query_params(
         "bytes",
-        "time",
         "size",
         "format",
         "h",
@@ -218,16 +215,7 @@ class CatClient(NamespacedClient):
         )
 
     @query_params(
-        "bytes",
-        "time",
-        "size",
-        "format",
-        "h",
-        "help",
-        "local",
-        "master_timeout",
-        "s",
-        "v",
+        "bytes", "size", "format", "h", "help", "local", "master_timeout", "s", "v"
     )
     def shards(self, index=None, params=None):
         """
@@ -442,6 +430,7 @@ class CatClient(NamespacedClient):
         "h",
         "help",
         "nodes",
+        "node_id",
         "parent_task_id",
         "s",
         "v",
@@ -458,6 +447,10 @@ class CatClient(NamespacedClient):
         :arg h: Comma-separated list of column names to display
         :arg help: Return help information, default False
         :arg 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 (used for older version of Elasticsearch)
+        :arg 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
diff --git a/elasticsearch/client/cluster.py b/elasticsearch/client/cluster.py
index be694e3e..63f662fa 100644
--- a/elasticsearch/client/cluster.py
+++ b/elasticsearch/client/cluster.py
@@ -3,16 +3,17 @@ from .utils import NamespacedClient, query_params, _make_path
 
 class ClusterClient(NamespacedClient):
     @query_params(
+        "expand_wildcards",
         "level",
         "local",
         "master_timeout",
         "timeout",
         "wait_for_active_shards",
         "wait_for_events",
+        "wait_for_no_initializing_shards",
         "wait_for_no_relocating_shards",
         "wait_for_nodes",
         "wait_for_status",
-        "wait_for_no_initializing_shards",
     )
     def health(self, index=None, params=None):
         """
@@ -20,6 +21,9 @@ class ClusterClient(NamespacedClient):
         `<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html>`_
 
         :arg index: Limit the information returned to a specific index
+        :arg expand_wildcards: Whether to expand wildcard expression to concrete
+            indices that are open, closed or both., default 'all', valid choices
+            are: 'open', 'closed', 'none', 'all'
         :arg level: Specify the level of detail for returned information,
             default 'cluster', valid choices are: 'cluster', 'indices', 'shards'
         :arg local: Return local information, do not retrieve the state from
@@ -66,6 +70,8 @@ class ClusterClient(NamespacedClient):
         "ignore_unavailable",
         "local",
         "master_timeout",
+        "wait_for_metadata_version",
+        "wait_for_timeout",
     )
     def state(self, metric=None, index=None, params=None):
         """
@@ -87,6 +93,10 @@ class ClusterClient(NamespacedClient):
         :arg local: Return local information, do not retrieve the state from
             master node (default: false)
         :arg master_timeout: Specify timeout for connection to master
+        :arg wait_for_metadata_version: Wait for the metadata version to be
+            equal or greater than the specified metadata version
+        :arg wait_for_timeout: The maximum time to wait for
+            wait_for_metadata_version before timing out
         """
         if index and not metric:
             metric = "_all"
@@ -174,6 +184,13 @@ class ClusterClient(NamespacedClient):
             "PUT", "/_cluster/settings", params=params, body=body
         )
 
+    @query_params()
+    def remote_info(self, params=None):
+        """
+        `<http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html>`_
+        """
+        return self.transport.perform_request("GET", "/_remote/info", params=params)
+
     @query_params("include_disk_info", "include_yes_decisions")
     def allocation_explain(self, body=None, params=None):
         """
diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py
index d371dde4..dc3b3603 100644
--- a/elasticsearch/client/indices.py
+++ b/elasticsearch/client/indices.py
@@ -80,7 +80,7 @@ class IndicesClient(NamespacedClient):
 
     @query_params(
         "master_timeout",
-        "request_timeout",
+        "timeout" "request_timeout",
         "wait_for_active_shards",
         "include_type_name",
     )
@@ -92,6 +92,7 @@ class IndicesClient(NamespacedClient):
         :arg index: The name of the index
         :arg body: The configuration for the index (`settings` and `mappings`)
         :arg master_timeout: Specify timeout for connection to master
+        :arg timeout: Explicit operation timeout
         :arg request_timeout: Explicit operation timeout
         :arg wait_for_active_shards: Set the number of active shards to wait for
             before the operation returns.
@@ -112,6 +113,7 @@ class IndicesClient(NamespacedClient):
         "include_defaults",
         "local",
         "include_type_name",
+        "master_timeout",
     )
     def get(self, index, feature=None, params=None):
         """
@@ -132,6 +134,7 @@ class IndicesClient(NamespacedClient):
             master node (default: false)
         :arg include_type_name: Specify whether requests and responses should include a
             type name (default: depends on Elasticsearch version).
+        :arg master_timeout: Specify timeout for connection to master
         """
         if index in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'index'.")
@@ -144,7 +147,9 @@ class IndicesClient(NamespacedClient):
         "expand_wildcards",
         "ignore_unavailable",
         "master_timeout",
+        "timeout",
         "request_timeout",
+        "wait_for_active_shards",
     )
     def open(self, index, params=None):
         """
@@ -161,7 +166,10 @@ class IndicesClient(NamespacedClient):
         :arg ignore_unavailable: Whether specified concrete indices should be
             ignored when unavailable (missing or closed)
         :arg master_timeout: Specify timeout for connection to master
+        :arg timeout: Explicit operation timeout
         :arg request_timeout: Explicit operation timeout
+        :arg wait_for_active_shards: Sets the number of active shards to wait
+            for before the operation returns.
         """
         if index in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'index'.")
@@ -175,6 +183,7 @@ class IndicesClient(NamespacedClient):
         "ignore_unavailable",
         "master_timeout",
         "request_timeout",
+        "wait_for_active_shards",
     )
     def close(self, index, params=None):
         """
@@ -193,6 +202,8 @@ class IndicesClient(NamespacedClient):
             ignored when unavailable (missing or closed)
         :arg master_timeout: Specify timeout for connection to master
         :arg request_timeout: Explicit operation timeout
+        :arg wait_for_active_shards: Sets the number of active shards to wait
+            for before the operation returns.
         """
         if index in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'index'.")
@@ -204,6 +215,7 @@ class IndicesClient(NamespacedClient):
         "allow_no_indices",
         "expand_wildcards",
         "ignore_unavailable",
+        "timeout",
         "master_timeout",
         "request_timeout",
     )
@@ -221,6 +233,7 @@ class IndicesClient(NamespacedClient):
             choices are: 'open', 'closed', 'none', 'all'
         :arg ignore_unavailable: Ignore unavailable indexes (default: false)
         :arg master_timeout: Specify timeout for connection to master
+        :arg timeout: Explicit operation timeout
         :arg request_timeout: Explicit operation timeout
         """
         if index in SKIP_IN_PATH:
@@ -291,6 +304,7 @@ class IndicesClient(NamespacedClient):
         "expand_wildcards",
         "ignore_unavailable",
         "master_timeout",
+        "timeout",
         "request_timeout",
         "include_type_name",
     )
@@ -313,7 +327,8 @@ class IndicesClient(NamespacedClient):
         :arg ignore_unavailable: Whether specified concrete indices should be
             ignored when unavailable (missing or closed)
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Explicit operation timeout
+        :arg timeout: Explicit operation timeout
+        :arg request_timeout: Explicit operation timeout (For pre 7.x ES Clusters)
         :arg include_type_name: Specify whether requests and responses should include a
             type name (default: depends on Elasticsearch version).
         """
@@ -330,6 +345,7 @@ class IndicesClient(NamespacedClient):
         "ignore_unavailable",
         "local",
         "include_type_name",
+        "master_timeout",
     )
     def get_mapping(self, index=None, doc_type=None, params=None):
         """
@@ -350,6 +366,7 @@ class IndicesClient(NamespacedClient):
             master node (default: false)
         :arg include_type_name: Specify whether requests and responses should include a
             type name (default: depends on Elasticsearch version).
+        :arg master_timeout: Specify timeout for connection to master
         """
         return self.transport.perform_request(
             "GET", _make_path(index, "_mapping", doc_type), params=params
@@ -461,7 +478,7 @@ class IndicesClient(NamespacedClient):
             "GET", _make_path(index, "_alias", name), params=params
         )
 
-    @query_params("master_timeout", "request_timeout")
+    @query_params("master_timeout", "request_timeout", "timeout")
     def update_aliases(self, body, params=None):
         """
         Update specified aliases.
@@ -469,7 +486,8 @@ class IndicesClient(NamespacedClient):
 
         :arg body: The definition of `actions` to perform
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Request timeout
+        :arg request_timeout: Request timeout (For pre 7.x ES Clusters)
+        :arg timeout: Request timeout
         """
         if body in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'body'.")
@@ -477,7 +495,7 @@ class IndicesClient(NamespacedClient):
             "POST", "/_aliases", params=params, body=body
         )
 
-    @query_params("master_timeout", "request_timeout")
+    @query_params("master_timeout", "request_timeout", "timeout")
     def delete_alias(self, index, name, params=None):
         """
         Delete specific alias.
@@ -489,7 +507,8 @@ class IndicesClient(NamespacedClient):
             wildcards); use `_all` to delete all aliases for the specified
             indices.
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Explicit timeout for the operation
+        :arg request_timeout: Explicit timeout for the operation (for pre 7.x ES clusters)
+        :arg timeout: Explicit timeout for the operation
         """
         for param in (index, name):
             if param in SKIP_IN_PATH:
@@ -504,6 +523,7 @@ class IndicesClient(NamespacedClient):
         "master_timeout",
         "order",
         "request_timeout",
+        "timeout",
         "include_type_name",
     )
     def put_template(self, name, body, params=None):
@@ -520,7 +540,8 @@ class IndicesClient(NamespacedClient):
         :arg master_timeout: Specify timeout for connection to master
         :arg order: The order for this template when merging multiple matching
             ones (higher numbers are merged later, overriding the lower numbers)
-        :arg request_timeout: Explicit operation timeout
+        :arg request_timeout: Explicit operation timeout (For pre ES 6 clusters)
+        :arg timeout: Explicit operation timeout
         :arg include_type_name: Specify whether requests and responses should include a
             type name (default: depends on Elasticsearch version).
         """
@@ -569,7 +590,7 @@ class IndicesClient(NamespacedClient):
             "GET", _make_path("_template", name), params=params
         )
 
-    @query_params("master_timeout", "request_timeout")
+    @query_params("master_timeout", "request_timeout", "timeout")
     def delete_template(self, name, params=None):
         """
         Delete an index template by its name.
@@ -577,7 +598,8 @@ class IndicesClient(NamespacedClient):
 
         :arg name: The name of the template
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Explicit operation timeout
+        :arg request_timeout: Explicit operation timeout (for pre 7.x clusters)
+        :arg timeout: Explicit operation timeout
         """
         if name in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'name'.")
@@ -592,6 +614,7 @@ class IndicesClient(NamespacedClient):
         "ignore_unavailable",
         "include_defaults",
         "local",
+        "master_timeout",
     )
     def get_settings(self, index=None, name=None, params=None):
         """
@@ -614,6 +637,7 @@ class IndicesClient(NamespacedClient):
             the indices., default False
         :arg local: Return local information, do not retrieve the state from
             master node (default: false)
+        :arg master_timeout: Specify timeout for connection to master
         """
         return self.transport.perform_request(
             "GET", _make_path(index, "_settings", name), params=params
@@ -625,6 +649,7 @@ class IndicesClient(NamespacedClient):
         "flat_settings",
         "ignore_unavailable",
         "master_timeout",
+        "timeout",
         "preserve_existing",
     )
     def put_settings(self, body, index=None, params=None):
@@ -648,6 +673,7 @@ class IndicesClient(NamespacedClient):
         :arg preserve_existing: Whether to update existing settings. If set to
             `true` existing settings on an index remain unchanged, the default
             is `false`
+        :arg timeout: Explicit operation timeout
         """
         if body in SKIP_IN_PATH:
             raise ValueError("Empty value passed for a required argument 'body'.")
@@ -657,10 +683,13 @@ class IndicesClient(NamespacedClient):
 
     @query_params(
         "completion_fields",
+        "expand_wildcards",
         "fielddata_fields",
         "fields",
+        "forbid_closed_indices",
         "groups",
         "include_segment_file_sizes",
+        "include_unloaded_segments",
         "level",
         "types",
     )
@@ -674,15 +703,24 @@ class IndicesClient(NamespacedClient):
         :arg metric: Limit the information returned the specific metrics.
         :arg completion_fields: A comma-separated list of fields for `fielddata`
             and `suggest` index metric (supports wildcards)
+        :arg expand_wildcards: Whether to expand wildcard expression to concrete
+            indices that are open, closed or both., default 'open', valid
+            choices are: 'open', 'closed', 'none', 'all'
         :arg fielddata_fields: A comma-separated list of fields for `fielddata`
             index metric (supports wildcards)
         :arg fields: A comma-separated list of fields for `fielddata` and
             `completion` index metric (supports wildcards)
+        :arg 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
         :arg groups: A comma-separated list of search groups for `search` index
             metric
         :arg 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), default False
+        :arg include_unloaded_segments: If set to true segment stats will
+            include stats for segments that are not currently loaded into
+            memory, default False
         :arg level: Return stats aggregated at cluster, index or shard level,
             default 'indices', valid choices are: 'cluster', 'indices', 'shards'
         :arg types: A comma-separated list of document types for the `indexing`
@@ -980,14 +1018,15 @@ class IndicesClient(NamespacedClient):
         :arg max_num_segments: The number of segments the index should be merged
             into (default: dynamic)
         :arg only_expunge_deletes: Specify whether the operation should only
-            expunge deleted documents
-        :arg operation_threading: TODO: ?
+            expunge deleted documents (for pre 7.x ES clusters)
         """
         return self.transport.perform_request(
             "POST", _make_path(index, "_forcemerge"), params=params
         )
 
-    @query_params("master_timeout", "request_timeout", "wait_for_active_shards")
+    @query_params(
+        "master_timeout", "timeout", "request_timeout", "wait_for_active_shards"
+    )
     def shrink(self, index, target, body=None, params=None):
         """
         The shrink index API allows you to shrink an existing index into a new
@@ -1006,7 +1045,8 @@ class IndicesClient(NamespacedClient):
         :arg body: The configuration for the target index (`settings` and
             `aliases`)
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Explicit operation timeout
+        :arg request_timeout: Explicit operation timeout (For pre 7.x ES clusters)
+        :arg timeout: Explicit operation timeout
         :arg wait_for_active_shards: Set the number of active shards to wait for
             on the shrunken index before the operation returns.
         """
@@ -1017,10 +1057,32 @@ class IndicesClient(NamespacedClient):
             "PUT", _make_path(index, "_shrink", target), params=params, body=body
         )
 
+    @query_params("master_timeout", "timeout", "wait_for_active_shards")
+    def split(self, index, target, body=None, params=None):
+        """
+        `<http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html>`_
+
+        :arg index: The name of the source index to split
+        :arg target: The name of the target index to split into
+        :arg body: The configuration for the target index (`settings` and
+            `aliases`)
+        :arg master_timeout: Specify timeout for connection to master
+        :arg timeout: Explicit operation timeout
+        :arg wait_for_active_shards: Set the number of active shards to wait for
+            on the shrunken index before the operation returns.
+        """
+        for param in (index, target):
+            if param in SKIP_IN_PATH:
+                raise ValueError("Empty value passed for a required argument.")
+        return self.transport.perform_request(
+            "PUT", _make_path(index, "_split", target), params=params, body=body
+        )
+
     @query_params(
         "dry_run",
         "master_timeout",
         "request_timeout",
+        "timeout",
         "wait_for_active_shards",
         "include_type_name",
     )
@@ -1042,7 +1104,8 @@ class IndicesClient(NamespacedClient):
             but not actually performed even if a condition matches. The default
             is false
         :arg master_timeout: Specify timeout for connection to master
-        :arg request_timeout: Explicit operation timeout
+        :arg request_timeout: Explicit operation timeout (for pre 7.x ES clusters)
+        :arg timeout: Explicit operation timeout
         :arg wait_for_active_shards: Set the number of active shards to wait for
             on the newly created rollover index before the operation returns.
         :arg include_type_name: Specify whether requests and responses should include a
diff --git a/elasticsearch/client/ingest.py b/elasticsearch/client/ingest.py
index c3144e6e..bc66c331 100644
--- a/elasticsearch/client/ingest.py
+++ b/elasticsearch/client/ingest.py
@@ -67,3 +67,12 @@ class IngestClient(NamespacedClient):
             params=params,
             body=body,
         )
+
+    @query_params()
+    def processor_grok(self, params=None):
+        """
+        `<https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get>`_
+        """
+        return self.transport.perform_request(
+            "GET", "/_ingest/processor/grok", params=params
+        )
diff --git a/elasticsearch/client/nodes.py b/elasticsearch/client/nodes.py
index e009fa89..9549f062 100644
--- a/elasticsearch/client/nodes.py
+++ b/elasticsearch/client/nodes.py
@@ -2,12 +2,16 @@ from .utils import NamespacedClient, query_params, _make_path
 
 
 class NodesClient(NamespacedClient):
-    @query_params()
-    def reload_secure_settings(self, params=None):
+    @query_params("timeout")
+    def reload_secure_settings(self, node_id=None, params=None):
         """
         Reload any settings that have been marked as "reloadable"
         `<https://www.elastic.co/guide/en/elasticsearch/reference/current/secure-settings.html#reloadable-secure-settings>`_
 
+        :arg 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.
+        :arg timeout: Explicit operation timeout
         """
         return self.transport.perform_request(
             "POST", _make_path("_nodes", "reload_secure_settings"), params=params
@@ -82,7 +86,7 @@ class NodesClient(NamespacedClient):
         )
 
     @query_params(
-        "type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
+        "doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
     )
     def hot_threads(self, node_id=None, params=None):
         """
diff --git a/elasticsearch/client/xpack/__init__.py b/elasticsearch/client/xpack/__init__.py
index 8c108c08..21e45a26 100644
--- a/elasticsearch/client/xpack/__init__.py
+++ b/elasticsearch/client/xpack/__init__.py
@@ -1,13 +1,20 @@
 from ..utils import NamespacedClient, query_params
 
+from .ccr import CcrClient
+from .data_frame import Data_FrameClient
+from .deprecation import DeprecationClient
 from .graph import GraphClient
+from .ilm import IlmClient
+from .indices import IndicesClient
 from .license import LicenseClient
+from .migration import MigrationClient
+from .ml import MlClient
 from .monitoring import MonitoringClient
+from .rollup import RollupClient
 from .security import SecurityClient
+from .sql import SqlClient
+from .ssl import SslClient
 from .watcher import WatcherClient
-from .ml import MlClient
-from .migration import MigrationClient
-from .deprecation import DeprecationClient
 
 
 class XPackClient(NamespacedClient):
@@ -15,14 +22,21 @@ class XPackClient(NamespacedClient):
 
     def __init__(self, *args, **kwargs):
         super(XPackClient, self).__init__(*args, **kwargs)
+        self.ccr = CcrClient(self.client)
+        self.data_frame = Data_FrameClient(self.client)
+        self.deprecation = DeprecationClient(self.client)
         self.graph = GraphClient(self.client)
+        self.ilm = IlmClient(self.client)
+        self.indices = IndicesClient(self.client)
         self.license = LicenseClient(self.client)
+        self.migration = MigrationClient(self.client)
+        self.ml = MlClient(self.client)
         self.monitoring = MonitoringClient(self.client)
+        self.rollup = RollupClient(self.client)
         self.security = SecurityClient(self.client)
+        self.sql = SqlClient(self.client)
+        self.ssl = SslClient(self.client)
         self.watcher = WatcherClient(self.client)
-        self.ml = MlClient(self.client)
-        self.migration = MigrationClient(self.client)
-        self.deprecation = DeprecationClient(self.client)
 
     @query_params("categories", "human")
     def info(self, params=None):
diff --git a/elasticsearch/helpers/actions.py b/elasticsearch/helpers/actions.py
index 1d233b46..61469f53 100644
--- a/elasticsearch/helpers/actions.py
+++ b/elasticsearch/helpers/actions.py
@@ -454,13 +454,8 @@ def scan(
                         "Scroll request has only succeeded on %d shards out of %d."
                         % (resp["_shards"]["successful"], resp["_shards"]["total"]),
                     )
-
-            resp = client.scroll(
-                scroll_id,
-                scroll=scroll,
-                request_timeout=request_timeout,
-                **scroll_kwargs
-            )
+            scroll_kwargs.update({"scroll_id": scroll_id, "scroll": scroll})
+            resp = client.scroll(**scroll_kwargs)
             scroll_id = resp.get("_scroll_id")
 
     finally:


Test patch:
diff --git a/test_elasticsearch/test_client/__init__.py b/test_elasticsearch/test_client/__init__.py
index 8e0c67ca..4cd410a6 100644
--- a/test_elasticsearch/test_client/__init__.py
+++ b/test_elasticsearch/test_client/__init__.py
@@ -96,4 +96,4 @@ class TestClient(ElasticsearchTestCase):
     def test_index_uses_put_if_id_is_not_empty(self):
         self.client.index(index="my-index", id=0, body={})
 
-        self.assert_url_called("PUT", "/my-index/_doc/0")
+        self.assert_url_called("POST", "/my-index/_doc/0")