How can i conditionally change the unit of metric values i receive?

How can I change the unit as per my metric path ?

Not sure to understand what you mean, a bit more detail and maybe even examples would be appreciated.

In the meantime, have you checked Elasticsearch runtime fields? It may be the feature you are looking for.