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

Improve type errors in painless with user-friendly suggestions #53904

Open
stu-elastic opened this issue Mar 20, 2020 · 1 comment
Open

Improve type errors in painless with user-friendly suggestions #53904

stu-elastic opened this issue Mar 20, 2020 · 1 comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement Team:Core/Infra Meta label for core/infra team

Comments

@stu-elastic
Copy link
Contributor

It can be hard to know the types one is working with in a painless script without having mappings in ones head.

Say field is a date and you have the following script:

doc['field'] + 5

Our current error is:
Cannot apply [+] operation to types [org.elasticsearch.index.fielddata.ScriptDocValues.Dates] and [java.lang.Integer].

For common failures, particularly around dates, we can provide a more human error, such as:

"You tried to add a number to a Date. Check out this link to learn how to convert a date to epoch time."

cc: @bmcconaghy @cjcenizal

@stu-elastic stu-elastic added >enhancement :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Mar 20, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Scripting)

@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 2020
@rjernst rjernst added the needs:triage Requires assignment of a team area label label Dec 3, 2020
@stu-elastic stu-elastic removed the needs:triage Requires assignment of a team area label label Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

No branches or pull requests

3 participants