# Trouble searching but not indexing when cluster name changed

**URL:** <https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734>\
**Category:** Elasticsearch\
**Created:** [June 15, 2015, 8:38pm UTC](https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734 "2015-06-15T20:38:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![imarsman](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@imarsman](https://discuss.elastic.co/u/imarsman)\
**Post date:** [June 15, 2015, 8:38pm UTC](https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734/1 "2015-06-15T20:38:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![imarsman](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@imarsman](https://discuss.elastic.co/u/imarsman)\
**Post date:** [June 16, 2015, 5:03pm UTC](https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734/2 "2015-06-16T17:03:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![imarsman](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@imarsman](https://discuss.elastic.co/u/imarsman)\
**Post date:** [June 16, 2015, 9:21pm UTC](https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734/3 "2015-06-16T21:21:16Z")

</div>

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.

---

<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, 12:07am UTC](https://discuss.elastic.co/t/trouble-searching-but-not-indexing-when-cluster-name-changed/2734/4 "2017-07-06T00:07:13Z")

</div>

Closed on July 6, 2017, 12:07am UTC


