Skip to content

Commit

Permalink
hsearch-es: Add options to configure indexing queues
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Apr 2, 2020
1 parent 7b485d9 commit 92c6e40
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ private void contributeBackendRuntimeProperties(BiConsumer<String, Object> prope
ElasticsearchIndexSettings.SCHEMA_MANAGEMENT_MINIMAL_REQUIRED_STATUS_WAIT_TIMEOUT,
elasticsearchBackendConfig.indexDefaults.schemaManagement.requiredStatusWaitTimeout, Optional::isPresent,
d -> d.get().toMillis());
addBackendDefaultIndexConfig(propertyCollector, backendName,
ElasticsearchIndexSettings.INDEXING_QUEUE_COUNT,
elasticsearchBackendConfig.indexDefaults.indexing.queueCount);
addBackendDefaultIndexConfig(propertyCollector, backendName,
ElasticsearchIndexSettings.INDEXING_QUEUE_SIZE,
elasticsearchBackendConfig.indexDefaults.indexing.queueSize);
addBackendDefaultIndexConfig(propertyCollector, backendName,
ElasticsearchIndexSettings.INDEXING_MAX_BULK_SIZE,
elasticsearchBackendConfig.indexDefaults.indexing.maxBulkSize);

for (Entry<String, ElasticsearchIndexConfig> indexConfigEntry : runtimeConfig.defaultBackend.indexes.entrySet()) {
String indexName = indexConfigEntry.getKey();
Expand All @@ -168,6 +177,15 @@ private void contributeBackendRuntimeProperties(BiConsumer<String, Object> prope
ElasticsearchIndexSettings.SCHEMA_MANAGEMENT_MINIMAL_REQUIRED_STATUS_WAIT_TIMEOUT,
indexConfig.schemaManagement.requiredStatusWaitTimeout, Optional::isPresent,
d -> d.get().toMillis());
addBackendIndexConfig(propertyCollector, backendName, indexName,
ElasticsearchIndexSettings.INDEXING_QUEUE_COUNT,
indexConfig.indexing.queueCount);
addBackendIndexConfig(propertyCollector, backendName, indexName,
ElasticsearchIndexSettings.INDEXING_QUEUE_SIZE,
indexConfig.indexing.queueSize);
addBackendIndexConfig(propertyCollector, backendName, indexName,
ElasticsearchIndexSettings.INDEXING_MAX_BULK_SIZE,
indexConfig.indexing.maxBulkSize);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ public static class ElasticsearchIndexConfig {
*/
@ConfigItem
ElasticsearchIndexSchemaManagementConfig schemaManagement;

/**
* Configuration for the indexing process that creates, updates and deletes documents.
*/
@ConfigItem
ElasticsearchIndexIndexingConfig indexing;
}

@ConfigGroup
Expand Down Expand Up @@ -455,4 +461,30 @@ public static class ElasticsearchIndexSchemaManagementConfig {
@ConfigItem(defaultValueDocumentation = "10S")
Optional<Duration> requiredStatusWaitTimeout;
}

// We can't set actual default values in this section,
// otherwise "quarkus.hibernate-search.elasticsearch.index-defaults" will be ignored.
@ConfigGroup
public static class ElasticsearchIndexIndexingConfig {
/**
* The number of indexing queues assigned to each index.
*/
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "10")
OptionalInt queueCount;

/**
* The size of indexing queues.
*/
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "1000")
OptionalInt queueSize;

/**
* The maximum size of bulk requests created when processing indexing queues.
*/
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "100")
OptionalInt maxBulkSize;
}
}

0 comments on commit 92c6e40

Please sign in to comment.