Trouble searching but not indexing when cluster name changed

I have code that stores items in a dated index on a test elasticsearch server. When the cluster name is set to the default "elasticsearch" items go in and can be retrieved fine.

Today I tried switching the cluster name to the server to elasticsearch-staging. I adjusted the "cluster.name" Java TransportClient value in the calling code that sets up a shared client. With this change Elasticsearch created new indexes along with the change in cluster name. This is fine, as the system is for testing purposes.

Items are stored fine into the new index by calling client code but searches return no results. Code is able to verify the existence of the index prior to search but the search still returns no results.

Here is some calling code that is no longer working

final AndFilterBuilder afb = new AndFilterBuilder();
afb.add(FilterBuilders.termFilter("document.file-path", path));
response = transportClient.prepareSearch(index)
		.setTypes("document")
		.setPostFilter(afb)
		.execute()
		.get();

Using elasticsearch 1.5.2 from the Elasticsearch debian distribution

Here is the code to set up the connector:

final Settings settings = ImmutableSettings
		.settingsBuilder()
		.put("cluster.name", CLUSTER_NAME)
		// .put("client.transport.ignore_cluster_name", true)
		.build();
final TransportClient tcClient = new TransportClient(settings);

for (final String ip : IPS.get()) {
	client.addTransportAddress(new InetSocketTransportAddress(ip, 9300));
}

I have tried it with just client.transport.ignore_cluster_name and just client.name. I have tried a cluster name with and without hypens. I can get a listing of files using the head browser.

Solved it. It had nothing to do with the code or the general configuration of Elasticsearch. I had neglected to set up the document templates in the new cluster setup with proper type mapping. With this, indexing was allowed but searching had nothing to work with.