private final EsClient client;
private final String indexName;
private boolean large = false;
- private boolean refresh = true;
private long flushByteSize = FLUSH_BYTE_SIZE;
private BulkRequestBuilder bulkRequest = null;
private Map<String, Object> largeInitialSettings = null;
return this;
}
- public BulkIndexer setRefresh(boolean b) {
- Preconditions.checkState(bulkRequest == null, ALREADY_STARTED_MESSAGE);
- this.refresh = b;
- return this;
- }
-
/**
* Default value is {@link org.sonar.server.es.BulkIndexer#FLUSH_BYTE_SIZE}
* @see org.elasticsearch.common.unit.ByteSizeValue
progress.stop();
}
- if (refresh) {
- client.prepareRefresh(indexName).get();
- }
+ client.prepareRefresh(indexName).get();
if (large) {
// optimize lucene segments and revert index settings
// Optimization must be done before re-applying replicas:
public void define(IndexDefinitionContext context) {
NewIndex index = context.create(INDEX);
+ // refresh is handled by IssueIndexer
+ index.getSettings().put("index.refresh_interval", "-1");
+
// shards
boolean clusterMode = settings.getBoolean(ProcessConstants.CLUSTER_ACTIVATE);
if (clusterMode) {
@Test
public void index_documents() throws Exception {
- BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX)
- .setRefresh(true);
+ BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX);
indexer.start();
indexer.add(newIndexRequest(42));
indexer.add(newIndexRequest(78));