import org.sonar.core.persistence.Dto;
import javax.annotation.Nullable;
-
import java.io.IOException;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.ExecutionException;
public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serializable>
/* Cluster And ES Stats/Client methods */
private void initializeManagementIndex() {
- LOG.info("Setup of Management Index for ES");
+ LOG.debug("Setup of Management Index for ES");
String index = indexDefinition.getManagementIndex();
try {
if (!indexExistsResponse.isExists()) {
- LOG.info("Setup of {} for type {}", this.getIndexName(), this.getIndexType());
+ LOG.debug("Setup of {} for type {}", this.getIndexName(), this.getIndexType());
getClient().admin().indices().prepareCreate(index)
.setSettings(getIndexSettings())
.execute().actionGet();
}
- LOG.info("Update of index {} for type {}", this.getIndexName(), this.getIndexType());
+ LOG.debug("Update of index {} for type {}", this.getIndexName(), this.getIndexType());
getClient().admin().indices().preparePutMapping(index)
.setType(getIndexType())
.setIgnoreConflicts(true)
private void setLastSynchronization() {
Date time = new Date();
if (time.after(getLastSynchronization())) {
- LOG.info("Updating synchTime updating");
+ LOG.debug("Updating synchTime updating");
getClient().prepareUpdate()
.setId(indexDefinition.getIndexName())
.setType(indexDefinition.getManagementType())
}
protected void updateDocument(Collection<UpdateRequest> requests, KEY key) throws Exception {
- LOG.info("UPDATE _id:{} in index {}", key, this.getIndexName());
+ LOG.debug("UPDATE _id:{} in index {}", key, this.getIndexName());
BulkRequestBuilder bulkRequest = getClient().prepareBulk();
for (UpdateRequest request : requests) {
bulkRequest.add(request
@Override
public void delete(Object obj, KEY key) throws Exception {
- LOG.info("DELETE NESTED _id:{} in index {}", key, this.getIndexName());
+ LOG.debug("DELETE NESTED _id:{} in index {}", key, this.getIndexName());
this.updateDocument(this.normalizer.deleteNested(obj, key), key);
}