# Index Routing does not work with Transport Client

**URL:** <https://discuss.elastic.co/t/index-routing-does-not-work-with-transport-client/9105>\
**Category:** Elasticsearch\
**Created:** [September 22, 2012, 12:18pm UTC](https://discuss.elastic.co/t/index-routing-does-not-work-with-transport-client/9105 "2012-09-22T12:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Amit](https://discuss.elastic.co/u/Amit)\
**Post date:** [September 22, 2012, 12:18pm UTC](https://discuss.elastic.co/t/index-routing-does-not-work-with-transport-client/9105/1 "2012-09-22T12:18:00Z")

</div>

All,

I am using elastic search version 0.19.4.

My requirement is to index the documents to a particular node and exclude the rest of the nodes. Hence for multiple index requests. I would manage which node the index should go to.

I tried the index routing mechanism but this does not seem to work with the version mentioned above.

My test scenario;  
1- started 3 ES nodes with node.tag: node1 , node.tag: node2 and node.tag: node3 respectively.  
2- I am using transport client to communicate the ES nodes.  
3- I am using bulk index api to index the document.  
4- None of the api available with Transport Client or Bulk request allow me to hook the index.routing.allocation.include.tag or index.routing.allocation.exclude.tag.  
5- Used UpdateSettingsRequest but it did not help either.

Sample code;  
Settings s = ImmutableSettings.settingsBuilder().put("testRouting").put("client.transport.sniff", true).build();  
TransportClient tc = new TransportClient(s);  
tc.addTransportAddress(new InetSocketTransportAddress("192.168.1.2", 9300));  
tc.addTransportAddress(new InetSocketTransportAddress("192.168.1.2", 9301));  
tc.addTransportAddress(new InetSocketTransportAddress("192.168.1.2", 9302));

```
	UpdateSettingsRequest updateSettings = new UpdateSettingsRequest();
	HashMap<String, String> hashMap = new HashMap<String, String>();
	hashMap.put("index.routing.allocation.include.tag","node1" ) ;
	hashMap.put("index.routing.allocation.exclude.tag","node2,node3" ) ;
	hashMap.put("index.routing.allocation.total_shards_per_node", "3");
            String[] indices = new String[1];
	indices[0] ="test*"; 
            updateSettings.indices(indices);
	updateSettings.settings(hashMap);
	
	while (true) {
		BulkRequestBuilder bulkRequest = tc.prepareBulk();
		for (int i = 0; i < 3; i++) {
			System.out.println( "------" + i);
			bulkRequest.add(Requests.indexRequest("test" + i).type("type").source("field", "value"));

		}
		bulkRequest.execute().actionGet();
	}

```

Please suggest if I am missing something or the feature is not in 0.19.4.  
If not how can I make to work with the available scenario.

Thanks  
Amit

I have tried the other option as well to update the settings via client\>admin\>indices\>updatesettings but even than I am not able to rout;

UpdateSettingsRequest updateSettings = new UpdateSettingsRequest();  
HashMap\<String, String\> hashMap = new HashMap\<String, String\>();  
hashMap.put("index.routing.allocation.include.tag","node1" ) ;  
hashMap.put("index.routing.allocation.exclude.tag","node2,node3" ) ;  
hashMap.put("index.routing.allocation.total\_shards\_per\_node", "3");  
updateSettings.settings(hashMap);  
String[] indices = new String[3];  
indices[0] ="test0";  
indices[1] ="test1";  
indices[2] ="test2";  
updateSettings.indices(indices);  
tc.admin().indices().updateSettings(updateSettings).actionGet();

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:11am UTC](https://discuss.elastic.co/t/index-routing-does-not-work-with-transport-client/9105/2 "2017-07-06T03:11:47Z")

</div>


