Open efd6 opened 1 year ago
Discussed this offline with @efd6 as this ticket has a rather wide scope (and concerns two separate areas, ingest and painless) he'll be reaching out to the corresponding areas with targeted questions to spark a wider discussion. For now labeling as core/infra/scripting.
Pinging @elastic/es-core-infra (Team:Core/Infra)
Pinging @elastic/es-data-management (Team:Data Management)
Description
Background
Informative errors in response to incorrect user or developer input are crucial for good UX/DX. Making errors clear and immediately actionable makes errors informative.
Examples of good errors are seen in Rust where compilation failures not only highlight source context, but a provide short summary to the reason for the error, possible alternatives and often a link to relevant documentation (described here)
Example from SO:
The Go tool chain provides similar though generally terser error messages in response to compilation errors, usually providing hints to the cause of the error and context that would be helpful to resolve the issue.
Problem
Elasticsearch ingest and painless compilation errors do provide some information, but this information is often extremely general and not well contextualised in a way that would support the user to quickly identify the cause of the problem.
Ingest
This is an example from a recent issue in the integrations repo.
The complete error:
It turned out that this failure was due to the document containing an array of string in
modsec.audit.details
and the field is defined as aflattened
. For a user to identify the basis for the failure they would need to understand the terse description of the parse failure and then make the jump to understanding that aflattened
is not equivalent to the full set of the JSON spec but must be an object or array of objects.A hint saying something like "a flattened field expects an object or array of object, but was given an array or strings" would make the error immediately obvious.
Painless
Here is an artificial example from an intentionally corrupted painless script where the
ctx.
prefix has been omitted from an assignment statement, this kind of error is a reasonably likely user error.This gives a compile error with the reconstructable text:
A "did you mean ctx.process.parent?" message would greatly improve the experience of the user in this situation.