Reputation: 424
I am using one alias for search with one index index_1
with is_write_index
set to true
. Due to mapping changes I need to reindex and this is my indexing process.
index_2
with the new mappingindex_1
to index_2
index_1
to index_2
with is_write_index
set to true
for index_2
index_1
to index_2
to sync the latest changesindex_1
The issue I am having is that from step 3, queries to the alias is returning duplicate results. How to avoid this issue ?
Upvotes: 3
Views: 1986
Reputation: 424
Found the answer, the short term solution I found is to use filters when setting aliases to filter out duplicate results from index_2. So for example.
POST /_aliases
{
"actions": [
{
"add": {
"index": "index_1",
"alias": "aliasName",
"is_write_index": true
}
},
{
"add": {
"index": "index_2",
"alias": "aliasName",
"filter": {
"term": {
"myGuaranteedToExistField": "impossibleToFindValue"
}
}
}
}
]
}
When indexing is done and things are verified I can flip the indices. Not sure if this is the best solution though but it works.
Upvotes: 1