By it did not work, I mean that the error "IMMEDIATE variable could not be found" still persists even after using setRefrreshPolicy(RefreshPolicy.IMMEDIATE).
During initial upgrades I was trying with Rest client but then I was facing some issue so I decided to stay with Transport client as suggested by Tim Vernum in this post-
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.