Reindex and aliases (keep routing policy)


#1

I'm using alias per user. For each alias I'm linking a routing and a filter:

PUT _/<index>/_alias/u1@u1.com'
{
  "routing": "u1@u1.com",
  "filter": {
    "term": {
      "user": "u1@u1.com"
    }
  }
}

So, I'm setting that indexation and searching is using routing information.

I want to reindex all documents on another index using _reindex api. After having created the new index, I've created all aliases. So, I figure out that documents have to be reindexed using aliases in order to keep routing policy.

Is there any way to set it up on _reindex?

Example:

POST _/_reindex
{
  "source": {
    "index": "old"
  },
  "dest": {
    "index": "new"
  }
}
'

Any ideas?


(Luca Wintergerst) #2

Hi,
_reindex will preserve your routing values.
If you would like to change them you can either use what _reindex provides (take a look here https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) or you can use the _ingest functionality (https://www.elastic.co/guide/en/elasticsearch/reference/5.4/ingest.html)


(system) #3

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