# Search includes closed index =\> ClusterBlockException

**URL:** <https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956>\
**Category:** Elasticsearch\
**Created:** [February 3, 2015, 2:13pm UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956 "2015-02-03T14:13:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![msbreuer](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@msbreuer](https://discuss.elastic.co/u/msbreuer)\
**Post date:** [February 3, 2015, 2:13pm UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956/1 "2015-02-03T14:13:33Z")

</div>

I am using elasticsearch api for searching indexes. Several physical  
indexes are bound to an alias and the java client simply uses the alias to  
search in all indexes. This works if any referenced index is available, but  
it causes an ClusterBlockException if one of the physical indexes is  
closed. I tried to advise ES to ignore closed indexes, but it does not work  
as I expected.

```
  SearchRequestBuilder srb = esClient.prepareSearch(this.indexName);  

```

\<== alias name bound to several indexes  
srb.setIndicesOptions(IndicesOptions.strictExpandOpenAndForbidClosed  
());  
String json = getJsonQuery();  
srb.setSource(json);  
SearchResponse sr = srb.execute().actionGet(); \<== Causes  
ClusterBlockException

How to advise ES to ignore closed/unavailable indexes? I tried several  
options from IndicesOptions.\<...\>, but none of them does the expected. Are  
there best practices?

regards,  
markus

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/79ad34b2-e78c-424d-93f0-8de8cf215d24%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/79ad34b2-e78c-424d-93f0-8de8cf215d24%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![msbreuer](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@msbreuer](https://discuss.elastic.co/u/msbreuer)\
**Post date:** [February 4, 2015, 9:50am UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956/2 "2015-02-04T09:50:18Z")

</div>

Any idea how to handle closed indexes? My understanding of closing an index  
is, to remove it from searching without physically deleting it. When  
working with aliases a closed index causes an cluster blocked exception.  
How can I avoid this?

The IndicesOptions looks like that, but they do not work with an index  
alias. Seems they work with wildcards. Basically what is the concept of  
closed indexes?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 4, 2015, 10:45am UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956/3 "2015-02-04T10:45:25Z")

</div>

Closed indexes are used if you still want the data but not taking up heap,  
eg for long term archive still in the cluster.

On 4 February 2015 at 20:50, [msbreuer@gmail.com](mailto:msbreuer@gmail.com) wrote:

> Any idea how to handle closed indexes? My understanding of closing an  
> index is, to remove it from searching without physically deleting it. When  
> working with aliases a closed index causes an cluster blocked exception.  
> How can I avoid this?
> 
> The IndicesOptions looks like that, but they do not work with an index  
> alias. Seems they work with wildcards. Basically what is the concept of  
> closed indexes?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/adb27d12-f609-4225-a49c-dec4abdb09c2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X8XWwzaBz8khD6zBEYV%2BUuDaUUjn9-pgQYJqsoYHpvw\_w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X8XWwzaBz8khD6zBEYV%2BUuDaUUjn9-pgQYJqsoYHpvw_w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![msbreuer](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@msbreuer](https://discuss.elastic.co/u/msbreuer)\
**Post date:** [February 5, 2015, 7:32am UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956/4 "2015-02-05T07:32:23Z")

</div>

> Closed indexes are used if you still want the data but not taking up heap,  
> eg for long term archive still in the cluster.

That is still what I expected. A closed index remains on hard disk and  
cannot be queried. But I also expected such indices to be ignored by  
queries, even if they are referenced by an alias. Currently closing an  
index makes the alias unusable. The application itself has to determine all  
referenced indexes and to filter out the closed ones.

Are there reasons why ES doesn't filter them? Also java and json api offer  
such filters, but they won't work for an alias. Seems they only work for  
index wildcards, but this is different from using an alias.

regards,  
markus

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/77d88834-94f6-43a1-b71c-ae0bd7a7928a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/77d88834-94f6-43a1-b71c-ae0bd7a7928a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:34am UTC](https://discuss.elastic.co/t/search-includes-closed-index-clusterblockexception/21956/5 "2017-07-06T00:34:52Z")

</div>


