if (resolveConflicts) {
String index = getElasticSearchIndexNameFromDatabase(database);
// the following debug code is verbose in the hopes of better understanding CBES-13
MultiGetResponse response = null;
if(client != null) {
MultiGetRequestBuilder builder = client.prepareMultiGet();
if(builder != null) {
if(index == null) {
logger.debug("index is null");
}
int added = 0;
for (String id : responseMap.keySet()) {
String type = typeSelector.getType(index, id);
if(documentTypeRoutingFields != null && documentTypeRoutingFields.containsKey(type)) {
// if this type requires special routing, we can't find it without the doc body
// so we skip this id in the lookup to avoid errors
continue;
}
builder = builder.add(index, type, id);
added++;
}
if(builder != null) {
if(added > 0) {
ListenableActionFuture<MultiGetResponse> laf = builder.execute();
if(laf != null) {
response = laf.actionGet();
} else {
logger.debug("laf was null");
}