Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log scroll response failures #1318

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion elasticsearch/helpers/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,27 @@ def scan(
resp["_shards"]["skipped"],
resp["_shards"]["total"],
)

resp_failures = resp["_shards"].get("failures")
failures = []
if resp_failures is not None:
for resp_failure in resp_failures:
failure = "Failure type[%s] received with reason: %s" % (
resp_failure["reason"]["type"],
resp_failure["reason"]["reason"],
)
failures.append(failure)
bartier marked this conversation as resolved.
Show resolved Hide resolved
logger.warning(failure)
if raise_on_error:
raise ScanError(
scroll_id,
"Scroll request has only succeeded on %d (+%d skiped) shards out of %d."
"Scroll request has only succeeded on %d (+%d skiped) shards out of %d.\n"
bartier marked this conversation as resolved.
Show resolved Hide resolved
"%s"
% (
resp["_shards"]["successful"],
resp["_shards"]["skipped"],
resp["_shards"]["total"],
"".join(failures),
),
)
resp = client.scroll(
Expand Down