Yes, the code works but only if the SalaryPerYear does not exist yet in the mappings.
You can update the mappings when you only add new fields (including alias field), but it is impossible to change existing fields mappings or delete existing fields.