Reindex data after changing default routing to a custom one

Good morning,

How can I reindex all data from one index to a new one which has custom routing (documents are indexed to a specific shard based on a routing value). I need to specify somehow the routing parameter for each document. I am looking for a fast solution because the current index has 30 million documents. I used before for reindexing (i.e. after changing mapping) a python client which provide helpers to assist with bulk requests and reindexing of documents from one index to another. But as this indexes documents using bulk api, I can not use it in my situation.