# Index alias filter evaluation

**URL:** <https://discuss.elastic.co/t/index-alias-filter-evaluation/65906>\
**Category:** Elasticsearch\
**Created:** [November 13, 2016, 12:34pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906 "2016-11-13T12:34:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [November 13, 2016, 12:34pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/1 "2016-11-13T12:34:05Z")

</div>

When index alias `filter` is evaluated? During alias creation or on 'interaction' with the alias?

Thanks.

---

<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:** [November 13, 2016, 10:50pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/2 "2016-11-13T22:50:22Z")

</div>

During interaction.

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [November 15, 2016, 9:36am UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/3 "2016-11-15T09:36:49Z")

</div>

That's not what I am experiencing.

I have 2 indices each having few documents

1. `test-1`
2. `test-2`

I've added an alias with wildcard

```
POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "test-*", "alias" : "mytest" } }
    ]
}

```

So far so good. Now I added a third index that matches the alias's wildcard  
3. `test-3`

I expected that querying the `mytest` alias will return documents from all 3 indices but I only got documents from the 2 initial indices (`test-1` & `test-2`) that existed when the alias was created.

What did I miss?

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [November 15, 2016, 9:40am UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/4 "2016-11-15T09:40:12Z")

</div>

Also found this in the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html)

> In this case, the alias is a point-in-time alias that will group all current indices that match, **it will not automatically update as new indices that match this pattern are added/removed**.

Is it possible to refresh the alias?

`POST /mytest/_refresh` didn't change a thing.

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 15, 2016, 12:17pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/5 "2016-11-15T12:17:51Z")

</div>

What Mark said is correct, as you asked when alias filters are evaluated. They are indeed evaluated at runtime.

Looking at your examples though, it must have been a terminology misunderstanding, as you really meant to ask when index expressions are expanded and associated with aliases. That happens when an alias gets created. Just remember that aliases are just some metadata information associated to indices. They don't have a life of their own, hence when created they get associated to indices that match their expressions, that's it.

Hope this clarifies things

Cheers  
Luca

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [November 15, 2016, 12:19pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/6 "2016-11-15T12:19:05Z")

</div>

Yes, it clarifies. Is it possible to refresh the index expression of an alias?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 15, 2016, 12:20pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/7 "2016-11-15T12:20:28Z")

</div>

No it is not possible, you need to remove and add back the alias, using the index aliases api.

Otherwise you could use an index template and automatically add aliases to newly created indices.

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [November 15, 2016, 12:47pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/8 "2016-11-15T12:47:05Z")

</div>

> Otherwise you could use an index template and automatically add aliases to newly created indices.

Yep.

I thought that the index template can be used only to create new aliases. It turns out that it can add new indices to existing aliases as well! Perfect.

Thanks.

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 15, 2016, 1:26pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/9 "2016-11-15T13:26:56Z")

</div>

yes indeed. You can associate an existing alias with a new index, the point is that creating an alias or modifying one doesn't really make any difference looking at what an alias is. It is just a piece of metadata that gets associated to an index.

Cheers  
Luca

---

<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:** [December 13, 2016, 1:27pm UTC](https://discuss.elastic.co/t/index-alias-filter-evaluation/65906/10 "2016-12-13T13:27:07Z")

</div>

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