Problem statement: I would like to import data from one index to another index without compromising on data loss and impacting search from web.
Approach taken
I have an index development_users_en_gb and would like to import data to development_users_en_gb_v1
- development_users_en_gb index has one development_users_en_gb_read and development_users_en_gb_write alias
curl -XGET "http://localhost:9200/development_users_en_gb/_alias/*"
{
"development_users_en_gb" : {
"aliases" : {
"development_users_en_gb_read" : { },
"development_users_en_gb_write" : {
"is_write_index" : true
}
}
}
}
- created new index development_users_en_gb_v1
- Updated the write alias(development_users_en_gb_write) to point to new index name development_users_en_gb_v1
POST /_aliases
{
"actions" : [
{ "remove" : { "index" : "development_users_en_gb", "alias" : "development_users_en_gb_write" } },
{ "add" : { "index" : "development_users_en_gb_v1", "alias" : "development_users_en_gb_write" } }
]
}
curl -XGET "http://localhost:9200/development_users_en_gb/_alias"
{
"development_users_en_gb" : {
"aliases" : {
"development_users_en_gb_read" : { }
}
}
}
curl -XGET "http://localhost:9200/development_users_en_gb_v1/_alias"
{
"development_users_en_gb_v1" : {
"aliases" : {
"development_users_en_gb_write" : {
"is_write_index" : true
}
}
}
}
The development_users_en_gb_read alias is pointing to development_users_en_gb index(the old index) and development_users_en_gb_write is pointing towards development_users_en_gb_v1(the new index)
4. Queried database and indexed all documents through development_users_en_gb_write alias
At this point, there is new document created from web but it never reaches development_users_en_gb_v1(new index). The count of document in development_users_en_gb is different than that of development_users_en_gb_v1
Question: Why I don't see the data getting pushed to development_users_en_gb_v1(new index) and not to development_users_en_gb(old index)
Appreciate your help!
Thanks