Hello,
we use elasticsearch now since version .11 and we really like it (currently
on .19.11). However, one thing thats a big problem for us is to update the
index while it is still queried by other requests.
We currently do a index-shift using alias in a java singleton e.g.:
private static String searchindex = "searchindex"; <- is only alias
private static String indexingIndexA = "indexingindex_a"; <- is a real index
private static String indexingIndexB = "indexingindex_b"; <- is a real index
String workingIndex;
String currentActiveSearchIndex;
if (singletonBean.getAliasTo().equals(indexingIndexA)) {
singletonBean.setAliasTo(indexingIndexB);
workingIndex = indexingIndexB;
currentActiveSearchIndex = indexingIndexA;
} else {
singletonBean.setAliasTo(indexingIndexA);
workingIndex = indexingIndexA;
currentActiveSearchIndex = indexingIndexB;
}
try {
client.admin().indices().delete(new
DeleteIndexRequest(workingIndex)).actionGet();
} catch (Exception e) {
logger.info(e.getMessage());
}
... do index work ....
client.admin().indices().refresh(new RefreshRequest(workingIndex));
client.admin().indices().aliases(new
IndicesAliasesRequest().removeAlias(currentActiveSearchIndex,
searchindex).addAlias(workingIndex, searchindex));
This runs quite well as long as its the only one that works on it. Now we
wanted to call ES from a second and third application and get the index
refreshed, however when in same time a request is done to the same index it
will lead to trouble as the alias swap can occure right in the middle.
How can we upgrade the whole index from any app without breaking the
ongoing requests of the other ones?
In solr there exists a "swap(index, index)" command where 2 indexes get
swapped in way that all requests prior to time x get done by first and
after that by second index, meaning that solr will handle the parallel
request problems.
Any help would be really appreciated.
Best Regards,
KB
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.