@@ -99,7 +99,11 @@ async def flush(self, index=None, params=None, headers=None):
99
99
)
100
100
101
101
@query_params (
102
- "include_type_name" , "master_timeout" , "timeout" , "wait_for_active_shards"
102
+ "include_type_name" ,
103
+ "master_timeout" ,
104
+ "timeout" ,
105
+ "wait_for_active_shards" ,
106
+ body_params = ["aliases" , "mappings" , "settings" ],
103
107
)
104
108
async def create (self , index , body = None , params = None , headers = None ):
105
109
"""
@@ -110,9 +114,14 @@ async def create(self, index, body=None, params=None, headers=None):
110
114
:arg index: The name of the index
111
115
:arg body: The configuration for the index (`settings` and
112
116
`mappings`)
117
+ :arg aliases:
113
118
:arg include_type_name: Whether a type should be expected in the
114
119
body of the mappings.
120
+ :arg mappings: Mapping for fields in the index. If specified,
121
+ this mapping can include: - Field names - Field data types - Mapping
122
+ parameters
115
123
:arg master_timeout: Specify timeout for connection to master
124
+ :arg settings:
116
125
:arg timeout: Explicit operation timeout
117
126
:arg wait_for_active_shards: Set the number of active shards to
118
127
wait for before the operation returns.
@@ -168,23 +177,29 @@ async def get(self, index, params=None, headers=None):
168
177
169
178
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-get-index.html>`_
170
179
171
- :arg index: A comma-separated list of index names
180
+ :arg index: Comma-separated list of data streams, indices, and
181
+ index aliases used to limit the request. Wildcard expressions (*) are
182
+ supported.
172
183
:arg allow_no_indices: Ignore if a wildcard expression resolves
173
- to no concrete indices (default: false)
174
- :arg expand_wildcards: Whether wildcard expressions should get
175
- expanded to open or closed indices (default: open) Valid choices: open,
176
- closed, hidden, none, all Default: open
177
- :arg flat_settings: Return settings in flat format (default:
178
- false)
179
- :arg ignore_unavailable: Ignore unavailable indexes (default:
180
- false)
181
- :arg include_defaults: Whether to return all default setting for
182
- each of the indices.
183
- :arg include_type_name: Whether to add the type name to the
184
- response (default: false)
185
- :arg local: Return local information, do not retrieve the state
186
- from master node (default: false)
187
- :arg master_timeout: Specify timeout for connection to master
184
+ to no concrete indices (default: false) Default: True
185
+ :arg expand_wildcards: Type of index that wildcard expressions
186
+ can match. If the request can target data streams, this argument
187
+ determines whether wildcard expressions match hidden data streams.
188
+ Supports comma-separated values, such as open,hidden. Valid choices:
189
+ open, closed, hidden, none, all Default: open
190
+ :arg flat_settings: If true, returns settings in flat format.
191
+ :arg ignore_unavailable: If false, requests that target a
192
+ missing index return an error.
193
+ :arg include_defaults: If true, return all default settings in
194
+ the response.
195
+ :arg include_type_name: If true, a mapping type is expected in
196
+ the body of mappings.
197
+ :arg local: If true, the request retrieves information from the
198
+ local node only. Defaults to false, which means information is retrieved
199
+ from the master node.
200
+ :arg master_timeout: Period to wait for a connection to the
201
+ master node. If no response is received before the timeout expires, the
202
+ request fails and returns an error. Default: 30s
188
203
"""
189
204
if index in SKIP_IN_PATH :
190
205
raise ValueError ("Empty value passed for a required argument 'index'." )
@@ -374,6 +389,20 @@ async def exists_type(self, index, doc_type, params=None, headers=None):
374
389
"master_timeout" ,
375
390
"timeout" ,
376
391
"write_index_only" ,
392
+ body_params = [
393
+ "_field_names" ,
394
+ "_meta" ,
395
+ "_routing" ,
396
+ "_source" ,
397
+ "date_detection" ,
398
+ "dynamic" ,
399
+ "dynamic_date_formats" ,
400
+ "dynamic_templates" ,
401
+ "numeric_detection" ,
402
+ "properties" ,
403
+ "runtime" ,
404
+ ],
405
+ body_required = True ,
377
406
)
378
407
async def put_mapping (
379
408
self , body , index = None , doc_type = None , params = None , headers = None
@@ -388,9 +417,26 @@ async def put_mapping(
388
417
should be added to (supports wildcards); use `_all` or omit to add the
389
418
mapping on all indices.
390
419
:arg doc_type: The name of the document type
420
+ :arg _field_names: Control whether field names are enabled for
421
+ the index.
422
+ :arg _meta: A mapping type can have custom meta data associated
423
+ with it. These are not used at all by Elasticsearch, but can be used to
424
+ store application-specific metadata.
425
+ :arg _routing: Enable making a routing value required on indexed
426
+ documents.
427
+ :arg _source: Control whether the _source field is enabled on
428
+ the index.
391
429
:arg allow_no_indices: Whether to ignore if a wildcard indices
392
430
expression resolves into no concrete indices. (This includes `_all`
393
431
string or when no indices have been specified)
432
+ :arg date_detection: Controls whether dynamic date detection is
433
+ enabled.
434
+ :arg dynamic: Controls whether new fields are added dynamically.
435
+ :arg dynamic_date_formats: If date detection is enabled then new
436
+ string fields are checked against 'dynamic_date_formats' and if the
437
+ value matches then a new date field is added instead of string.
438
+ :arg dynamic_templates: Specify dynamic templates for the
439
+ mapping.
394
440
:arg expand_wildcards: Whether to expand wildcard expression to
395
441
concrete indices that are open, closed or both. Valid choices: open,
396
442
closed, hidden, none, all Default: open
@@ -399,6 +445,11 @@ async def put_mapping(
399
445
:arg include_type_name: Whether a type should be expected in the
400
446
body of the mappings.
401
447
:arg master_timeout: Specify timeout for connection to master
448
+ :arg numeric_detection: Automatically map strings into numeric
449
+ data types for all fields.
450
+ :arg properties: Mapping for a field. For new fields, this
451
+ mapping can include: - Field name - Field data type - Mapping parameters
452
+ :arg runtime: Mapping of runtime fields for the index.
402
453
:arg timeout: Explicit operation timeout
403
454
:arg write_index_only: When true, applies mappings only to the
404
455
write index of an alias or data stream
@@ -411,7 +462,7 @@ async def put_mapping(
411
462
412
463
return await self .transport .perform_request (
413
464
"PUT" ,
414
- _make_path (index , doc_type , "_mapping " ),
465
+ _make_path (index , doc_type , "_mappings " ),
415
466
params = params ,
416
467
headers = headers ,
417
468
body = body ,
@@ -498,7 +549,17 @@ async def get_field_mapping(
498
549
headers = headers ,
499
550
)
500
551
501
- @query_params ("master_timeout" , "timeout" )
552
+ @query_params (
553
+ "master_timeout" ,
554
+ "timeout" ,
555
+ body_params = [
556
+ "filter" ,
557
+ "index_routing" ,
558
+ "is_write_index" ,
559
+ "routing" ,
560
+ "search_routing" ,
561
+ ],
562
+ )
502
563
async def put_alias (self , index , name , body = None , params = None , headers = None ):
503
564
"""
504
565
Creates or updates an alias.
@@ -511,7 +572,12 @@ async def put_alias(self, index, name, body=None, params=None, headers=None):
511
572
:arg name: The name of the alias to be created or updated
512
573
:arg body: The settings for the alias, such as `routing` or
513
574
`filter`
575
+ :arg filter:
576
+ :arg index_routing:
577
+ :arg is_write_index:
514
578
:arg master_timeout: Specify timeout for connection to master
579
+ :arg routing:
580
+ :arg search_routing:
515
581
:arg timeout: Explicit timestamp for the document
516
582
"""
517
583
for param in (index , name ):
@@ -520,7 +586,7 @@ async def put_alias(self, index, name, body=None, params=None, headers=None):
520
586
521
587
return await self .transport .perform_request (
522
588
"PUT" ,
523
- _make_path (index , "_alias " , name ),
589
+ _make_path (index , "_aliases " , name ),
524
590
params = params ,
525
591
headers = headers ,
526
592
body = body ,
@@ -616,10 +682,28 @@ async def delete_alias(self, index, name, params=None, headers=None):
616
682
raise ValueError ("Empty value passed for a required argument." )
617
683
618
684
return await self .transport .perform_request (
619
- "DELETE" , _make_path (index , "_alias" , name ), params = params , headers = headers
685
+ "DELETE" ,
686
+ _make_path (index , "_aliases" , name ),
687
+ params = params ,
688
+ headers = headers ,
620
689
)
621
690
622
- @query_params ("create" , "include_type_name" , "master_timeout" , "order" )
691
+ @query_params (
692
+ "create" ,
693
+ "flat_settings" ,
694
+ "include_type_name" ,
695
+ "master_timeout" ,
696
+ "timeout" ,
697
+ body_params = [
698
+ "aliases" ,
699
+ "index_patterns" ,
700
+ "mappings" ,
701
+ "order" ,
702
+ "settings" ,
703
+ "version" ,
704
+ ],
705
+ body_required = True ,
706
+ )
623
707
async def put_template (self , name , body , params = None , headers = None ):
624
708
"""
625
709
Creates or updates an index template.
@@ -628,14 +712,26 @@ async def put_template(self, name, body, params=None, headers=None):
628
712
629
713
:arg name: The name of the template
630
714
:arg body: The template definition
631
- :arg create: Whether the index template should only be added if
632
- new or can also replace an existing one
715
+ :arg aliases: Aliases for the index.
716
+ :arg create: If true, this request cannot replace or update
717
+ existing index templates.
718
+ :arg flat_settings:
633
719
:arg include_type_name: Whether a type should be returned in the
634
720
body of the mappings.
635
- :arg master_timeout: Specify timeout for connection to master
636
- :arg order: The order for this template when merging multiple
637
- matching ones (higher numbers are merged later, overriding the lower
638
- numbers)
721
+ :arg index_patterns: Array of wildcard expressions used to match
722
+ the names of indices during creation.
723
+ :arg mappings: Mapping for fields in the index.
724
+ :arg master_timeout: Period to wait for a connection to the
725
+ master node. If no response is received before the timeout expires, the
726
+ request fails and returns an error. Default: 30s
727
+ :arg order: Order in which Elasticsearch applies this template
728
+ if index matches multiple templates. Templates with lower 'order' values
729
+ are merged first. Templates with higher 'order' values are merged later,
730
+ overriding templates with lower values.
731
+ :arg settings: Configuration options for the index.
732
+ :arg timeout:
733
+ :arg version: Version number used to manage index templates
734
+ externally. This number is not automatically generated by Elasticsearch.
639
735
"""
640
736
for param in (name , body ):
641
737
if param in SKIP_IN_PATH :
@@ -814,9 +910,7 @@ async def stats(self, index=None, metric=None, params=None, headers=None):
814
910
:arg index: A comma-separated list of index names; use `_all` or
815
911
empty string to perform the operation on all indices
816
912
:arg metric: Limit the information returned the specific
817
- metrics. Valid choices: _all, completion, docs, fielddata, query_cache,
818
- flush, get, indexing, merge, request_cache, refresh, search, segments,
819
- store, warmer, suggest
913
+ metrics.
820
914
:arg completion_fields: A comma-separated list of fields for
821
915
`fielddata` and `suggest` index metric (supports wildcards)
822
916
:arg expand_wildcards: Whether to expand wildcard expression to
0 commit comments