Open spinscale opened 2 years ago
Pinging @elastic/es-core-infra (Team:Core/Infra)
I thought we already had an issue for this, I know we have discussed it in the last few months. https://github.com/elastic/elasticsearch/pull/77044 should make this possible. Similarly, we've discussed having a "did you mean" when a method isn't found at all, but is similar to an existing method name.
Sometimes painless decides to implement a subset of methods to not implement slow or dangerous methods - which is good.
I just ran into a tricky one from a debugging perspective. Java's List supports a
remove(Object)
method, in addition toList.remove(index)
. Painless does not. However the error messages are somewhat cryptic and even differ if I try to callremove
usingparams
or not. See this exampleThe above returns a
wrong_method_type_exception
statingThis one has the same intent, but returns a different error message
returns
If you know a little java, you can figure out, that the wrong
remove
method is called resulting in a class cast exception.Long story short: In addition to unify the error message, we should probably try to have more descriptive error messages stating that this method does not exist or suggest an alternative, especially because
Debug.explain()
returnsArrayList
despite painless not supporting all methods - which of course is listed in the docs correctly.