Proper way to dump indices from Elasticsearch and import to another Elasticsearch instance

That's almost the right process. You're pretty much taking a repository backup and then restoring it at the new location. However it's important that you don't modify the contents of a repository while it's registered with Elasticsearch (see these docs for details).

To follow the official repository backup process, you should unregister the repository on A before step 3, and you should not register the repository on B until after step 4.