Index alias filter evaluation


(Ilia Katz) #1

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

Thanks.


(Mark Walkom) #2

During interaction.


(Ilia Katz) #3

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?


(Ilia Katz) #4

Also found this in the documentation

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.


(Luca Cavanna) #5

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


(Ilia Katz) #6

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


(Luca Cavanna) #7

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.


(Ilia Katz) #8

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.


(Luca Cavanna) #9

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


(system) #10

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