Skip to content

Commit 23c0e32

Browse files
dliappisfxdgear
authored andcommitted
Add include_type_name in pertinent indices operations (elastic#902)
Closes elastic#901
1 parent 85573db commit 23c0e32

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

elasticsearch/client/indices.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def flush(self, index=None, params=None):
6969
return self.transport.perform_request('POST', _make_path(index,
7070
'_flush'), params=params)
7171

72-
@query_params('master_timeout', 'timeout', 'wait_for_active_shards')
72+
@query_params('master_timeout', 'timeout', 'wait_for_active_shards', 'include_type_name')
7373
def create(self, index, body=None, params=None):
7474
"""
7575
Create an index in Elasticsearch.
@@ -81,14 +81,16 @@ def create(self, index, body=None, params=None):
8181
:arg timeout: Explicit operation timeout
8282
:arg wait_for_active_shards: Set the number of active shards to wait for
8383
before the operation returns.
84+
:arg include_type_name: Specify whether requests and responses should include a
85+
type name (default: depends on Elasticsearch version).
8486
"""
8587
if index in SKIP_IN_PATH:
8688
raise ValueError("Empty value passed for a required argument 'index'.")
8789
return self.transport.perform_request('PUT', _make_path(index),
8890
params=params, body=body)
8991

9092
@query_params('allow_no_indices', 'expand_wildcards', 'flat_settings',
91-
'ignore_unavailable', 'include_defaults', 'local')
93+
'ignore_unavailable', 'include_defaults', 'local', 'include_type_name')
9294
def get(self, index, feature=None, params=None):
9395
"""
9496
The get index API allows to retrieve information about one or more indexes.
@@ -106,6 +108,8 @@ def get(self, index, feature=None, params=None):
106108
the indices., default False
107109
:arg local: Return local information, do not retrieve the state from
108110
master node (default: false)
111+
:arg include_type_name: Specify whether requests and responses should include a
112+
type name (default: depends on Elasticsearch version).
109113
"""
110114
if index in SKIP_IN_PATH:
111115
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -237,7 +241,7 @@ def exists_type(self, index, doc_type, params=None):
237241
'_mapping', doc_type), params=params)
238242

239243
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
240-
'master_timeout', 'timeout')
244+
'master_timeout', 'timeout','include_type_name')
241245
def put_mapping(self, doc_type, body, index=None, params=None):
242246
"""
243247
Register specific mapping definition for a specific type.
@@ -258,6 +262,8 @@ def put_mapping(self, doc_type, body, index=None, params=None):
258262
ignored when unavailable (missing or closed)
259263
:arg master_timeout: Specify timeout for connection to master
260264
:arg timeout: Explicit operation timeout
265+
:arg include_type_name: Specify whether requests and responses should include a
266+
type name (default: depends on Elasticsearch version).
261267
"""
262268
for param in (doc_type, body):
263269
if param in SKIP_IN_PATH:
@@ -266,7 +272,7 @@ def put_mapping(self, doc_type, body, index=None, params=None):
266272
'_mapping', doc_type), params=params, body=body)
267273

268274
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
269-
'local')
275+
'local','include_type_name')
270276
def get_mapping(self, index=None, doc_type=None, params=None):
271277
"""
272278
Retrieve mapping definition of index or index/type.
@@ -284,12 +290,14 @@ def get_mapping(self, index=None, doc_type=None, params=None):
284290
ignored when unavailable (missing or closed)
285291
:arg local: Return local information, do not retrieve the state from
286292
master node (default: false)
293+
:arg include_type_name: Specify whether requests and responses should include a
294+
type name (default: depends on Elasticsearch version).
287295
"""
288296
return self.transport.perform_request('GET', _make_path(index,
289297
'_mapping', doc_type), params=params)
290298

291299
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
292-
'include_defaults', 'local')
300+
'include_defaults', 'local', 'include_type_name')
293301
def get_field_mapping(self, fields, index=None, doc_type=None, params=None):
294302
"""
295303
Retrieve mapping definition of a specific field.
@@ -310,6 +318,8 @@ def get_field_mapping(self, fields, index=None, doc_type=None, params=None):
310318
returned as well
311319
:arg local: Return local information, do not retrieve the state from
312320
master node (default: false)
321+
:arg include_type_name: Specify whether requests and responses should include a
322+
type name (default: depends on Elasticsearch version).
313323
"""
314324
if fields in SKIP_IN_PATH:
315325
raise ValueError("Empty value passed for a required argument 'fields'.")
@@ -418,7 +428,7 @@ def delete_alias(self, index, name, params=None):
418428
'_alias', name), params=params)
419429

420430
@query_params('create', 'flat_settings', 'master_timeout', 'order',
421-
'timeout')
431+
'timeout', 'include_type_name')
422432
def put_template(self, name, body, params=None):
423433
"""
424434
Create an index template that will automatically be applied to new
@@ -434,6 +444,8 @@ def put_template(self, name, body, params=None):
434444
:arg order: The order for this template when merging multiple matching
435445
ones (higher numbers are merged later, overriding the lower numbers)
436446
:arg timeout: Explicit operation timeout
447+
:arg include_type_name: Specify whether requests and responses should include a
448+
type name (default: depends on Elasticsearch version).
437449
"""
438450
for param in (name, body):
439451
if param in SKIP_IN_PATH:
@@ -459,7 +471,7 @@ def exists_template(self, name, params=None):
459471
return self.transport.perform_request('HEAD', _make_path('_template',
460472
name), params=params)
461473

462-
@query_params('flat_settings', 'local', 'master_timeout')
474+
@query_params('flat_settings', 'local', 'master_timeout', 'include_type_name')
463475
def get_template(self, name=None, params=None):
464476
"""
465477
Retrieve an index template by its name.
@@ -471,6 +483,8 @@ def get_template(self, name=None, params=None):
471483
master node (default: false)
472484
:arg master_timeout: Explicit operation timeout for connection to master
473485
node
486+
:arg include_type_name: Specify whether requests and responses should include a
487+
type name (default: depends on Elasticsearch version).
474488
"""
475489
return self.transport.perform_request('GET', _make_path('_template',
476490
name), params=params)
@@ -846,7 +860,7 @@ def shrink(self, index, target, body=None, params=None):
846860
'_shrink', target), params=params, body=body)
847861

848862
@query_params('dry_run', 'master_timeout', 'timeout',
849-
'wait_for_active_shards')
863+
'wait_for_active_shards', 'include_type_name')
850864
def rollover(self, alias, new_index=None, body=None, params=None):
851865
"""
852866
The rollover index API rolls an alias over to a new index when the
@@ -868,6 +882,8 @@ def rollover(self, alias, new_index=None, body=None, params=None):
868882
:arg timeout: Explicit operation timeout
869883
:arg wait_for_active_shards: Set the number of active shards to wait for
870884
on the newly created rollover index before the operation returns.
885+
:arg include_type_name: Specify whether requests and responses should include a
886+
type name (default: depends on Elasticsearch version).
871887
"""
872888
if alias in SKIP_IN_PATH:
873889
raise ValueError("Empty value passed for a required argument 'alias'.")

0 commit comments

Comments
 (0)