Yes you would need to re-save all posts
To do this automatically your would need to hook into whatever it is that is saving these post in the first place and the field would need to exist already being created by whatever is creating the posts. What I’ve given you will only work when editing a post in the admin.