# IndicesOptions for DeleteByQueryAction (in ES 5.x)

**URL:** <https://discuss.elastic.co/t/indicesoptions-for-deletebyqueryaction-in-es-5-x/80219>\
**Category:** Elasticsearch\
**Created:** [March 28, 2017, 12:39am UTC](https://discuss.elastic.co/t/indicesoptions-for-deletebyqueryaction-in-es-5-x/80219 "2017-03-28T00:39:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![no\_jihun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/no_jihun/32/64028_2.png) [@no\_jihun](https://discuss.elastic.co/u/no_jihun)\
**Post date:** [March 28, 2017, 12:39am UTC](https://discuss.elastic.co/t/indicesoptions-for-deletebyqueryaction-in-es-5-x/80219/1 "2017-03-28T00:39:20Z")

</div>

I need to migrate this code to compatible with ES5.2

es 2.3.3 ver

```
	new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE).setIndices( //
			indexPrefix + "_" + yyyymmdd, //
			indexPrefix + "_" + DATE_FORMATTER.print(tomorrow.getTimeInMillis())) //
			.setIndicesOptions(IndicesOptions.fromOptions(true, true, false, false)) //
			.setTypes("band") //
			.setQuery(qb) //
			.execute().actionGet();

```

so I converted it like below.

es 5.2.2 ver

```
	BulkIndexByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)//
		.filter(qb)//
		.source(indexPrefix + "_" + yyyymmdd, indexPrefix + "_" + DATE_FORMATTER.print(tomorrow.getTimeInMillis()))//
		.get();

```

But I can not find "setIndicesOptions(...)" alternative at ES 5.2 API.  
How can I mute this kind of exception?

```
Exception in thread "main" [jpl_20170316] IndexNotFoundException[no such index]
	at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.infe(IndexNameExpressionResolver.java:660)
	at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.innerResolve(IndexNameExpressionResolver.java:617)
	at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.resolve(IndexNameExpressionResolver.java:567)
```

---

<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:** [April 25, 2017, 12:39am UTC](https://discuss.elastic.co/t/indicesoptions-for-deletebyqueryaction-in-es-5-x/80219/2 "2017-04-25T00:39:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
