Skip to content

Commit 4718027

Browse files
optional bodies
1 parent a67993b commit 4718027

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

elasticsearch/_async/client/indices.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,7 @@ async def create_from(
800800
raise ValueError("Empty value passed for parameter 'source'")
801801
if dest in SKIP_IN_PATH:
802802
raise ValueError("Empty value passed for parameter 'dest'")
803-
if create_from is None and body is None:
804-
raise ValueError(
805-
"Empty value passed for parameters 'create_from' and 'body', one of them should be set."
806-
)
807-
elif create_from is not None and body is not None:
803+
if create_from is not None and body is not None:
808804
raise ValueError("Cannot set both 'create_from' and 'body'")
809805
__path_parts: t.Dict[str, str] = {
810806
"source": _quote(source),
@@ -5140,11 +5136,7 @@ async def simulate_index_template(
51405136
"""
51415137
if name in SKIP_IN_PATH:
51425138
raise ValueError("Empty value passed for parameter 'name'")
5143-
if index_template is None and body is None:
5144-
raise ValueError(
5145-
"Empty value passed for parameters 'index_template' and 'body', one of them should be set."
5146-
)
5147-
elif index_template is not None and body is not None:
5139+
if index_template is not None and body is not None:
51485140
raise ValueError("Cannot set both 'index_template' and 'body'")
51495141
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
51505142
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'

elasticsearch/_sync/client/indices.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,7 @@ def create_from(
800800
raise ValueError("Empty value passed for parameter 'source'")
801801
if dest in SKIP_IN_PATH:
802802
raise ValueError("Empty value passed for parameter 'dest'")
803-
if create_from is None and body is None:
804-
raise ValueError(
805-
"Empty value passed for parameters 'create_from' and 'body', one of them should be set."
806-
)
807-
elif create_from is not None and body is not None:
803+
if create_from is not None and body is not None:
808804
raise ValueError("Cannot set both 'create_from' and 'body'")
809805
__path_parts: t.Dict[str, str] = {
810806
"source": _quote(source),
@@ -5140,11 +5136,7 @@ def simulate_index_template(
51405136
"""
51415137
if name in SKIP_IN_PATH:
51425138
raise ValueError("Empty value passed for parameter 'name'")
5143-
if index_template is None and body is None:
5144-
raise ValueError(
5145-
"Empty value passed for parameters 'index_template' and 'body', one of them should be set."
5146-
)
5147-
elif index_template is not None and body is not None:
5139+
if index_template is not None and body is not None:
51485140
raise ValueError("Cannot set both 'index_template' and 'body'")
51495141
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
51505142
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'

0 commit comments

Comments
 (0)