elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.81k stars 8.2k forks source link

Present more meaningful message in UI on ingest pipeline script processor error #155322

Open rseldner opened 1 year ago

rseldner commented 1 year ago

Describe the feature: While creating a script processor in an ingest pipeline from the Stack Management UI, if you specify a numeric constant that is too large for int type, the UI just spits out a script processor: compile error

Error Screenshot: image

Toast: image

The compile error message isn't very useful and difficult for users to understand, particularly since the error can potentially be presented outside of the user's view if there are a large amount of processors (i.e. the save button is at the bottom of the page, and user might need to scroll up to the top of the page to see the message).

If we were to inspect the browser's HTTP request, or use the Elasticsearch API to create the same pipeline, we can see a very clear and explicit explanation of the problem in the 400 response.

Invalid int constant [21448364890]. If you want a long constant then change it to [21448364890L]

Request:

It would be helpful to users to include this more meaningful information, perhaps in the toast popup. Alternatively, there could be some sort of validation performed when saving the processor but I imagine that is a much more cumbersome approach.

To reproduce...

Create and save a pipeline with the following script processor:

ctx.test = (ctx.myfield * 21448364890)
Screenshot ![image](https://user-images.githubusercontent.com/19536095/233137580-7264cbc4-28a9-4b7a-ac6b-680e2d9f8996.png)
ES API Equivalent: ``` PUT _ingest/pipeline/script-test { "processors": [ { "script": { "source": "ctx.test = (ctx.myfield * 21448364890)" } } ] } ```
elasticmachine commented 1 year ago

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

rseldner commented 1 year ago

this is not limited to the int/long situation. I can see the same thing if we cause a different type of script processor mistake/error:

ctx.test = ctx.my-field

image

image

So maybe we just need to see the 400 response's attributes.causes array to also be presented to the user.

elasticmachine commented 1 month ago

Pinging @elastic/kibana-management (Team:Kibana Management)