Hmm, I am not sure about the usage of ctx
variable over indices that belong to a remote cluster. I would be interested in knowing the details about it as well.
However, as a workaround you can take help of the bash script to achieve your objective.