When index alias filter
is evaluated? During alias creation or on 'interaction' with the alias?
Thanks.
When index alias filter
is evaluated? During alias creation or on 'interaction' with the alias?
Thanks.
During interaction.
That's not what I am experiencing.
I have 2 indices each having few documents
test-1
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?
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.
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
Yes, it clarifies. Is it possible to refresh the index expression of an alias?
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.
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.
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
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.