Dynamic index aliases


(Marcin Dojwa) #1

Hi,

Is there any way for making dynamic index aliases like:

curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{
"add" : {
"index" : "users",
"alias" : "user_X",
"filter" : { "term" : { "user" : X } }
"routing" : "X"
}
}
]
}'

Where X is any number ? What I do not want to do is to create alias for
each new user. I would like to create one alias which would:

  • for user_1 use 1 for routing and filter by user = 1
  • for user_2 use 2 for routing and filter by user = 2
    ...

Maybe there is any template that I could use that would automatically
create such an alias ?

Best regards.
Marcin Dojwa


(system) #2