Question about alises:
I have ES index with 10 min documents. I need to add new fields and values for each document. I am going to use Scroll Search API to get documents and Bulk API to copy documents into new index [adding new fields while copying]. After reindexing is finished I would like to use aliases to point on my new index.
First, before reindexing, I am going to set “my_index_alias” to point to OLD index:
curl -XPUT 'endpoint/oldindex/_alias/my_index_alias?pretty'
After reindexing is finished, I am going to switch aliases:
curl -XPOST ‘endpoint/_aliases?pretty' -H 'Content-Type: application/json' -d'
{
"actions": [
{ "remove": { "index": “oldindex", "alias": "my_index_alias" }},
{ "add": { "index": “newindex", "alias": "my_index_alias" }}
]
}
'
My first question is:
Is that correct approach?
My second question is:
I am not understand well switching aliases procedure Is that right, that after perform reindexing and switching aliases, I will be able to access my new index, the same way I access my old index? We using Java API in our program to access ES, so I wondering whether I need to make some code changes or not? Am I understanding right that after reindexing and switching I will be able call “endpoint/OLDINDEX” and get updated data with new field there? Or I need to make code changes and call “endpoint/NEWINDEX” instead? Or I need to make code changes in code to call “endpoint/my_index_alias”?? Can I call my alias the same way my old index is called [OLDINDEX]?
And one more question
In the OLDINDEX I have two types, for example, “typeone” and “typetwo”. I need to perform reindexing and backfill only for “typeone”. Will I be able to access “typetwo” the same way we did it before? Without any code changes?
Why I do need to prefer reindex in new index and dealing with switching aliases, if I can just use BULK API to update existed index’s documents with new fields?