Kibana visualization how to customize the mapping?

like this. the legend display 5000 or 1, but I want to display "success number or failed number"?

You may need to create a scripted field that returns "success" for the value 5000 and "failed" for the value 1.

Actually, once https://github.com/elastic/kibana/pull/45585 is merged, you will be able to go into index patterns, edit the field, and apply the "static lookup" field formatter to display the 5000 as "success" and the 1 as "failed".