Hi Boban,
If you use SolrCloud  Solrj client and initialise it with ZK, it should be aware of masters and send documents in a smart way.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/