# Resolving wildcard index names in ES 2.0

**URL:** <https://discuss.elastic.co/t/resolving-wildcard-index-names-in-es-2-0/34284>\
**Category:** Elasticsearch\
**Created:** [November 10, 2015, 8:44pm UTC](https://discuss.elastic.co/t/resolving-wildcard-index-names-in-es-2-0/34284 "2015-11-10T20:44:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cching](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cching/32/44800_2.png) [@cching](https://discuss.elastic.co/u/cching)\
**Post date:** [November 10, 2015, 8:44pm UTC](https://discuss.elastic.co/t/resolving-wildcard-index-names-in-es-2-0/34284/1 "2015-11-10T20:44:56Z")

</div>

Hi all,

I'm trying to convert this code:

```
String[] indices = client.admin().cluster().prepareState().execute().actionGet()
                               .getState().getMetaData()
                               .convertFromWildcards(match, IndicesOptions.lenientExpandOpen());

```

to ES 2.0. I see IndexNameExpressionResolve and WildcardExpressionResolver, but I can't seem to find a good way to instantiate these.

Anyone know how I can do this? I'm trying to resolve a bunch of indexes from a pattern to their concrete names if that isn't obvious from the code.

I appreciate any help!

Cheers,  
Craig

---

<div class="post-metadata">

**Author:** ![cching](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cching/32/44800_2.png) [@cching](https://discuss.elastic.co/u/cching)\
**Post date:** [November 11, 2015, 3:26pm UTC](https://discuss.elastic.co/t/resolving-wildcard-index-names-in-es-2-0/34284/2 "2015-11-11T15:26:50Z")

</div>

So I think I've resolved this, I'd like to share what I did and see if anyone can review and let me know if it's the expected way to do it.

Here's what I came up with:

```
IndexNameExpressionResolver resolver = new IndexNameExpressionResolver(Settings.EMPTY);
String [] indices = resolver.concreteIndices(cl.admin()
    .cluster().prepareState().get().getState(),
    IndicesOptions.lenientExpandOpen(),
        match);

```

Does that look like the idiomatic way to resolve index names based on a wildcard expression for ES 2.0? I guess I feel that with the @Inject annotation on IndexNameExpressionResolver and having to send in Settings.EMPTY, something just doesn't feel right.

I appreciate any responses!

---

<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 5, 2017, 11:39pm UTC](https://discuss.elastic.co/t/resolving-wildcard-index-names-in-es-2-0/34284/3 "2017-07-05T23:39:11Z")

</div>

Closed on July 5, 2017, 11:39pm UTC


