Skip to content

Commit cf1e946

Browse files
adamchainzfxdgear
authored andcommitted
Document that 'index' may also be a list of strings for most methods (elastic#921)
I discovered whilst researching scoutapp/scout_apm_python#150 that the index parameter for all methods also supports a list of strings, but this isn't documented here. For example `elasticsearch-dsl-py` [always passes a list of strings](https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_dsl/search.py#L100). It's [`_make_path`](https://github.com/elastic/elasticsearch-py/blob/master/elasticsearch/client/utils.py#L44) that allows this to happen. This updates the relevant methods' documentation to indicate that it is supported.
1 parent f4c163d commit cf1e946

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

elasticsearch/client/__init__.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ def search(self, index=None, body=None, params=None):
710710
Execute a search query and get back search hits that match the query.
711711
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html>`_
712712
713-
:arg index: A comma-separated list of index names to search; use `_all`
713+
:arg index: A list of index names to search, or a string containing a
714+
comma-separated list of index names to search; use `_all`
714715
or empty string to perform the operation on all indices
715716
:arg body: The search definition using the Query DSL
716717
:arg _source: True or false to return the _source field or not, or a
@@ -853,8 +854,9 @@ def update_by_query(self, index, body=None, params=None):
853854
Perform an update on all documents matching a query.
854855
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html>`_
855856
856-
:arg index: A comma-separated list of index names to search; use `_all`
857-
or empty string to perform the operation on all indices
857+
:arg index: A list of index names to search, or a string containing a
858+
comma-separated list of index names to search; use `_all` or the
859+
empty string to perform the operation on all indices
858860
:arg body: The search definition using the Query DSL
859861
:arg _source: True or false to return the _source field or not, or a
860862
list of fields to return
@@ -1024,8 +1026,9 @@ def delete_by_query(self, index, body, params=None):
10241026
Delete all documents matching a query.
10251027
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>`_
10261028
1027-
:arg index: A comma-separated list of index names to search; use `_all`
1028-
or empty string to perform the operation on all indices
1029+
:arg index: A list of index names to search, or a string containing a
1030+
comma-separated list of index names to search; use `_all` or the
1031+
empty string to perform the operation on all indices
10291032
:arg body: The search definition using the Query DSL
10301033
:arg _source: True or false to return the _source field or not, or a
10311034
list of fields to return
@@ -1115,8 +1118,9 @@ def search_shards(self, index=None, params=None):
11151118
out issues or planning optimizations with routing and shard preferences.
11161119
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html>`_
11171120
1118-
:arg index: A comma-separated list of index names to search; use `_all`
1119-
or empty string to perform the operation on all indices
1121+
:arg index: A list of index names to search, or a string containing a
1122+
comma-separated list of index names to search; use `_all` or the
1123+
empty string to perform the operation on all indices
11201124
:arg allow_no_indices: Whether to ignore if a wildcard indices
11211125
expression resolves into no concrete indices. (This includes `_all`
11221126
string or when no indices have been specified)
@@ -1153,8 +1157,9 @@ def search_template(self, index=None, body=None, params=None):
11531157
fill in template parameters.
11541158
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html>`_
11551159
1156-
:arg index: A comma-separated list of index names to search; use `_all`
1157-
or empty string to perform the operation on all indices
1160+
:arg index: A list of index names to search, or a string containing a
1161+
comma-separated list of index names to search; use `_all` or the
1162+
empty string to perform the operation on all indices
11581163
:arg body: The search definition template and its params
11591164
:arg allow_no_indices: Whether to ignore if a wildcard indices
11601165
expression resolves into no concrete indices. (This includes `_all`
@@ -1347,7 +1352,8 @@ def count(self, doc_type=None, index=None, body=None, params=None):
13471352
Execute a query and get the number of matches for that query.
13481353
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html>`_
13491354
1350-
:arg index: A comma-separated list of indices to restrict the results
1355+
:arg index: A list of index names or a string containing a
1356+
comma-separated list of index names to restrict the results to
13511357
:arg body: A query to restrict the results specified with the Query DSL
13521358
(optional)
13531359
:arg allow_no_indices: Whether to ignore if a wildcard indices
@@ -1453,7 +1459,8 @@ def msearch(self, body, index=None, params=None):
14531459
14541460
:arg body: The request definitions (metadata-search request definition
14551461
pairs), separated by newlines
1456-
:arg index: A comma-separated list of index names to use as default
1462+
:arg index: A list of index names, or a string containing a
1463+
comma-separated list of index names, to use as the default
14571464
:arg max_concurrent_searches: Controls the maximum number of concurrent
14581465
searches the multi search api will execute
14591466
:arg pre_filter_shard_size: A threshold that enforces a pre-filter
@@ -1672,7 +1679,8 @@ def msearch_template(self, body, index=None, params=None):
16721679
16731680
:arg body: The request definitions (metadata-search request definition
16741681
pairs), separated by newlines
1675-
:arg index: A comma-separated list of index names to use as default
1682+
:arg index: A list of index names, or a string containing a
1683+
comma-separated list of index names, to use as the default
16761684
:arg max_concurrent_searches: Controls the maximum number of concurrent
16771685
searches the multi search api will execute
16781686
:arg search_type: Search operation type, valid choices are:
@@ -1699,8 +1707,9 @@ def field_caps(self, index=None, body=None, params=None):
16991707
The field capabilities API allows to retrieve the capabilities of fields among multiple indices.
17001708
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html>`_
17011709
1702-
:arg index: A comma-separated list of index names; use `_all` or empty
1703-
string to perform the operation on all indices
1710+
:arg index: A list of index names, or a string containing a
1711+
comma-separated list of index names; use `_all` or the empty string
1712+
to perform the operation on all indices
17041713
:arg body: Field json objects containing an array of field names
17051714
:arg allow_no_indices: Whether to ignore if a wildcard indices
17061715
expression resolves into no concrete indices. (This includes `_all`

0 commit comments

Comments
 (0)