Remove include_type_name parameter from APIs (#156)

* Remove include_type_name parameter from APIs

Signed-off-by: Vacha Shah <[email protected]>

* Applying formatting

Signed-off-by: Vacha Shah <[email protected]>
This commit is contained in:
Vacha Shah
2022-04-20 13:58:13 -07:00
committed by GitHub
parent 6da20db2d1
commit 1569c05f08
6 changed files with 6 additions and 92 deletions
+3 -26
View File
@@ -104,9 +104,7 @@ class IndicesClient(NamespacedClient):
"POST", _make_path(index, "_flush"), params=params, headers=headers
)
@query_params(
"include_type_name", "master_timeout", "timeout", "wait_for_active_shards"
)
@query_params("master_timeout", "timeout", "wait_for_active_shards")
async def create(self, index, body=None, params=None, headers=None):
"""
Creates an index with optional settings and mappings.
@@ -115,8 +113,6 @@ class IndicesClient(NamespacedClient):
:arg index: The name of the index
:arg body: The configuration for the index (`settings` and
`mappings`)
:arg include_type_name: Whether a type should be expected in the
body of the mappings.
: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
@@ -162,7 +158,6 @@ class IndicesClient(NamespacedClient):
"flat_settings",
"ignore_unavailable",
"include_defaults",
"include_type_name",
"local",
"master_timeout",
)
@@ -183,8 +178,6 @@ class IndicesClient(NamespacedClient):
false)
:arg include_defaults: Whether to return all default setting for
each of the indices.
:arg include_type_name: Whether to add the type name to the
response (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
@@ -336,7 +329,6 @@ class IndicesClient(NamespacedClient):
"allow_no_indices",
"expand_wildcards",
"ignore_unavailable",
"include_type_name",
"master_timeout",
"timeout",
"write_index_only",
@@ -358,8 +350,6 @@ class IndicesClient(NamespacedClient):
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg include_type_name: Whether a type should be expected in the
body of the mappings.
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg write_index_only: When true, applies mappings only to the
@@ -380,7 +370,6 @@ class IndicesClient(NamespacedClient):
"allow_no_indices",
"expand_wildcards",
"ignore_unavailable",
"include_type_name",
"local",
"master_timeout",
)
@@ -398,8 +387,6 @@ class IndicesClient(NamespacedClient):
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg include_type_name: Whether to add the type name to the
response (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
@@ -416,7 +403,6 @@ class IndicesClient(NamespacedClient):
"expand_wildcards",
"ignore_unavailable",
"include_defaults",
"include_type_name",
"local",
)
async def get_field_mapping(self, fields, index=None, params=None, headers=None):
@@ -436,8 +422,6 @@ class IndicesClient(NamespacedClient):
should be ignored when unavailable (missing or closed)
:arg include_defaults: Whether the default mapping values should
be returned as well
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
:arg local: Return local information, do not retrieve the state
from master node (default: false)
"""
@@ -567,7 +551,7 @@ class IndicesClient(NamespacedClient):
"DELETE", _make_path(index, "_alias", name), params=params, headers=headers
)
@query_params("create", "include_type_name", "master_timeout", "order")
@query_params("create", "master_timeout", "order")
async def put_template(self, name, body, params=None, headers=None):
"""
Creates or updates an index template.
@@ -577,8 +561,6 @@ class IndicesClient(NamespacedClient):
:arg body: The template definition
:arg create: Whether the index template should only be added if
new or can also replace an existing one
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
: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
@@ -617,7 +599,7 @@ class IndicesClient(NamespacedClient):
"HEAD", _make_path("_template", name), params=params, headers=headers
)
@query_params("flat_settings", "include_type_name", "local", "master_timeout")
@query_params("flat_settings", "local", "master_timeout")
async def get_template(self, name=None, params=None, headers=None):
"""
Returns an index template.
@@ -626,8 +608,6 @@ class IndicesClient(NamespacedClient):
:arg name: The comma separated names of the index templates
:arg flat_settings: Return settings in flat format (default:
false)
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
:arg local: Return local information, do not retrieve the state
from master node (default: false)
:arg master_timeout: Explicit operation timeout for connection
@@ -1094,7 +1074,6 @@ class IndicesClient(NamespacedClient):
@query_params(
"dry_run",
"include_type_name",
"master_timeout",
"timeout",
"wait_for_active_shards",
@@ -1114,8 +1093,6 @@ class IndicesClient(NamespacedClient):
:arg 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
:arg include_type_name: Whether a type should be included in the
body of the mappings.
: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
-8
View File
@@ -94,7 +94,6 @@ class IndicesClient(NamespacedClient):
index: Any,
*,
body: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
@@ -142,7 +141,6 @@ class IndicesClient(NamespacedClient):
flat_settings: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -257,7 +255,6 @@ class IndicesClient(NamespacedClient):
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
write_index_only: Optional[Any] = ...,
@@ -281,7 +278,6 @@ class IndicesClient(NamespacedClient):
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -306,7 +302,6 @@ class IndicesClient(NamespacedClient):
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
@@ -431,7 +426,6 @@ class IndicesClient(NamespacedClient):
*,
body: Any,
create: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
order: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -472,7 +466,6 @@ class IndicesClient(NamespacedClient):
*,
name: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -838,7 +831,6 @@ class IndicesClient(NamespacedClient):
body: Optional[Any] = ...,
new_index: Optional[Any] = ...,
dry_run: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
+3 -26
View File
@@ -104,9 +104,7 @@ class IndicesClient(NamespacedClient):
"POST", _make_path(index, "_flush"), params=params, headers=headers
)
@query_params(
"include_type_name", "master_timeout", "timeout", "wait_for_active_shards"
)
@query_params("master_timeout", "timeout", "wait_for_active_shards")
def create(self, index, body=None, params=None, headers=None):
"""
Creates an index with optional settings and mappings.
@@ -115,8 +113,6 @@ class IndicesClient(NamespacedClient):
:arg index: The name of the index
:arg body: The configuration for the index (`settings` and
`mappings`)
:arg include_type_name: Whether a type should be expected in the
body of the mappings.
: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
@@ -162,7 +158,6 @@ class IndicesClient(NamespacedClient):
"flat_settings",
"ignore_unavailable",
"include_defaults",
"include_type_name",
"local",
"master_timeout",
)
@@ -183,8 +178,6 @@ class IndicesClient(NamespacedClient):
false)
:arg include_defaults: Whether to return all default setting for
each of the indices.
:arg include_type_name: Whether to add the type name to the
response (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
@@ -336,7 +329,6 @@ class IndicesClient(NamespacedClient):
"allow_no_indices",
"expand_wildcards",
"ignore_unavailable",
"include_type_name",
"master_timeout",
"timeout",
"write_index_only",
@@ -358,8 +350,6 @@ class IndicesClient(NamespacedClient):
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg include_type_name: Whether a type should be expected in the
body of the mappings.
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg write_index_only: When true, applies mappings only to the
@@ -383,7 +373,6 @@ class IndicesClient(NamespacedClient):
"allow_no_indices",
"expand_wildcards",
"ignore_unavailable",
"include_type_name",
"local",
"master_timeout",
)
@@ -401,8 +390,6 @@ class IndicesClient(NamespacedClient):
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg include_type_name: Whether to add the type name to the
response (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
@@ -419,7 +406,6 @@ class IndicesClient(NamespacedClient):
"expand_wildcards",
"ignore_unavailable",
"include_defaults",
"include_type_name",
"local",
)
def get_field_mapping(self, fields, index=None, params=None, headers=None):
@@ -439,8 +425,6 @@ class IndicesClient(NamespacedClient):
should be ignored when unavailable (missing or closed)
:arg include_defaults: Whether the default mapping values should
be returned as well
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
:arg local: Return local information, do not retrieve the state
from master node (default: false)
"""
@@ -570,7 +554,7 @@ class IndicesClient(NamespacedClient):
"DELETE", _make_path(index, "_alias", name), params=params, headers=headers
)
@query_params("create", "include_type_name", "master_timeout", "order")
@query_params("create", "master_timeout", "order")
def put_template(self, name, body, params=None, headers=None):
"""
Creates or updates an index template.
@@ -580,8 +564,6 @@ class IndicesClient(NamespacedClient):
:arg body: The template definition
:arg create: Whether the index template should only be added if
new or can also replace an existing one
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
: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
@@ -620,7 +602,7 @@ class IndicesClient(NamespacedClient):
"HEAD", _make_path("_template", name), params=params, headers=headers
)
@query_params("flat_settings", "include_type_name", "local", "master_timeout")
@query_params("flat_settings", "local", "master_timeout")
def get_template(self, name=None, params=None, headers=None):
"""
Returns an index template.
@@ -629,8 +611,6 @@ class IndicesClient(NamespacedClient):
:arg name: The comma separated names of the index templates
:arg flat_settings: Return settings in flat format (default:
false)
:arg include_type_name: Whether a type should be returned in the
body of the mappings.
:arg local: Return local information, do not retrieve the state
from master node (default: false)
:arg master_timeout: Explicit operation timeout for connection
@@ -1124,7 +1104,6 @@ class IndicesClient(NamespacedClient):
@query_params(
"dry_run",
"include_type_name",
"master_timeout",
"timeout",
"wait_for_active_shards",
@@ -1142,8 +1121,6 @@ class IndicesClient(NamespacedClient):
:arg 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
:arg include_type_name: Whether a type should be included in the
body of the mappings.
: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
-8
View File
@@ -94,7 +94,6 @@ class IndicesClient(NamespacedClient):
index: Any,
*,
body: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
@@ -142,7 +141,6 @@ class IndicesClient(NamespacedClient):
flat_settings: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -257,7 +255,6 @@ class IndicesClient(NamespacedClient):
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
write_index_only: Optional[Any] = ...,
@@ -281,7 +278,6 @@ class IndicesClient(NamespacedClient):
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -306,7 +302,6 @@ class IndicesClient(NamespacedClient):
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
@@ -431,7 +426,6 @@ class IndicesClient(NamespacedClient):
*,
body: Any,
create: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
order: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -472,7 +466,6 @@ class IndicesClient(NamespacedClient):
*,
name: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ...,
@@ -838,7 +831,6 @@ class IndicesClient(NamespacedClient):
body: Optional[Any] = ...,
new_index: Optional[Any] = ...,
dry_run: Optional[Any] = ...,
include_type_name: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
@@ -174,18 +174,6 @@ class AsyncYamlRunner(YamlRunner):
and str(w.message) not in allowed_warnings
]
# This warning can show up in many places but isn't accounted for
# in tests, so we remove it to make sure things pass.
include_type_name_warning = (
"[types removal] Using include_type_name in create index requests is deprecated. "
"The parameter will be removed in the next major version."
)
if (
include_type_name_warning in caught_warnings
and include_type_name_warning not in warn
):
caught_warnings.remove(include_type_name_warning)
# Sorting removes the issue with order raised. We only care about
# if all warnings are raised in the single API call.
if warn and sorted(warn) != sorted(caught_warnings):
@@ -257,18 +257,6 @@ class YamlRunner:
and str(w.message) not in allowed_warnings
]
# This warning can show up in many places but isn't accounted for
# in tests, so we remove it to make sure things pass.
include_type_name_warning = (
"[types removal] Using include_type_name in create index requests is deprecated. "
"The parameter will be removed in the next major version."
)
if (
include_type_name_warning in caught_warnings
and include_type_name_warning not in warn
):
caught_warnings.remove(include_type_name_warning)
# Sorting removes the issue with order raised. We only care about
# if all warnings are raised in the single API call.
if warn and sorted(warn) != sorted(caught_warnings):