Retaining Logstash Keystore Password Across Upgrades Without Repeated Commands

Hi, my requirement is as follows:

I installed Logstash on my server, and I successfully ran the commands logstash-keystore create and logstash-keystore add ES_PWD to set the keystore password. After this, I backed up the logstash-keystore.keystore file. Then, I upgraded Logstash and removed the logstash-keystore.keystore file from the config path. I replaced it with the old logstash-keystore.keystore file in the config path and started Logstash. However, now I am facing an error in the Logstash log folder that says, "Unable to connect to Elasticsearch" and "Unable to authenticate."

My question is: How can I retain the keystore password while upgrading Logstash without having to run the logstash-keystore create and logstash-keystore add ES_PWD commands every time? Are there any possible approaches to avoid these steps?

Regards,
Michael Mathan S