Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ private void contributeBackendRuntimeProperties(BiConsumer<String, Object> prope
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.PASSWORD,
elasticsearchBackendConfig.password);
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.CONNECTION_TIMEOUT,
elasticsearchBackendConfig.connectionTimeout,
Optional::isPresent, d -> d.get().toMillis());
elasticsearchBackendConfig.connectionTimeout.toMillis());
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.MAX_CONNECTIONS,
elasticsearchBackendConfig.maxConnections);
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.MAX_CONNECTIONS_PER_ROUTE,
Expand All @@ -140,8 +139,7 @@ private void contributeBackendRuntimeProperties(BiConsumer<String, Object> prope
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.DISCOVERY_ENABLED,
elasticsearchBackendConfig.discovery.enabled);
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.DISCOVERY_REFRESH_INTERVAL,
elasticsearchBackendConfig.discovery.refreshInterval,
Optional::isPresent, d -> d.get().getSeconds());
elasticsearchBackendConfig.discovery.refreshInterval.getSeconds());
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.DISCOVERY_SCHEME,
elasticsearchBackendConfig.discovery.defaultScheme);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

import org.hibernate.search.backend.elasticsearch.index.IndexLifecycleStrategyName;
import org.hibernate.search.backend.elasticsearch.index.IndexStatus;
Expand Down Expand Up @@ -52,7 +51,7 @@ public static class ElasticsearchBackendRuntimeConfig {
/**
* The list of hosts of the Elasticsearch servers.
*/
@ConfigItem
@ConfigItem(defaultValue = "http://localhost:9200")
List<String> hosts;

/**
Expand All @@ -70,20 +69,20 @@ public static class ElasticsearchBackendRuntimeConfig {
/**
* The connection timeout.
*/
@ConfigItem
Optional<Duration> connectionTimeout;
@ConfigItem(defaultValue = "3S")
Duration connectionTimeout;

/**
* The maximum number of connections to all the Elasticsearch servers.
*/
@ConfigItem
OptionalInt maxConnections;
@ConfigItem(defaultValue = "20")
int maxConnections;

/**
* The maximum number of connections per Elasticsearch server.
*/
@ConfigItem
OptionalInt maxConnectionsPerRoute;
@ConfigItem(defaultValue = "10")
int maxConnectionsPerRoute;

/**
* Configuration for the automatic discovery of new Elasticsearch nodes.
Expand All @@ -101,6 +100,7 @@ public static class ElasticsearchBackendRuntimeConfig {
* Per-index specific configuration.
*/
@ConfigItem
@ConfigDocMapKey("index-name")
Map<String, ElasticsearchIndexConfig> indexes;
}

Expand All @@ -119,20 +119,20 @@ public static class DiscoveryConfig {
/**
* Defines if automatic discovery is enabled.
*/
@ConfigItem
Optional<Boolean> enabled;
@ConfigItem(defaultValue = "false")
boolean enabled;

/**
* Refresh interval of the node list.
*/
@ConfigItem
Optional<Duration> refreshInterval;
@ConfigItem(defaultValue = "10S")
Duration refreshInterval;

/**
* The scheme that should be used for the new nodes discovered.
*/
@ConfigItem
Optional<String> defaultScheme;
@ConfigItem(defaultValue = "http")
String defaultScheme;
}

@ConfigGroup
Expand All @@ -150,8 +150,8 @@ public static class AutomaticIndexingConfig {
* When enabled, re-indexing of an entity is skipped if the only changes are on properties that are not used when
* indexing.
*/
@ConfigItem
Optional<Boolean> enableDirtyCheck;
@ConfigItem(defaultValue = "true")
boolean enableDirtyCheck;
}

@ConfigGroup
Expand All @@ -162,14 +162,11 @@ public static class AutomaticIndexingSynchronizationConfig {
* <p>
* Defines the status for which you wait before considering the operation completed by Hibernate Search.
* <p>
* Can be either one of "queued", "committed" or "searchable".
* <p>
* Using "searchable" is recommended in unit tests.
* <p>
* Defaults to "committed".
* Use {@code queued} or {@code committed} in production environments.
* {@code searchable} is useful in integration tests.
*/
@ConfigItem
Optional<AutomaticIndexingSynchronizationStrategyName> strategy;
@ConfigItem(defaultValue = "committed")
AutomaticIndexingSynchronizationStrategyName strategy;
}

@ConfigGroup
Expand All @@ -193,38 +190,35 @@ public static class SearchQueryLoadingCacheLookupConfig {

/**
* The strategy to use when loading entities during the execution of a search query.
* <p>
* Can be either one of "skip", "persistence-context" or "persistence-context-then-second-level-cache".
* <p>
* Defaults to "skip".
*/
@ConfigItem
Optional<EntityLoadingCacheLookupStrategy> strategy;
@ConfigItem(defaultValue = "skip")
EntityLoadingCacheLookupStrategy strategy;
}

// We can't set actual default values in this section,
// otherwise "quarkus.hibernate-search.elasticsearch.index-defaults" will be ignored.
@ConfigGroup
public static class LifecycleConfig {

/**
* The strategy used for index lifecycle.
* <p>
* Must be one of: none, validate, update, create, drop-and-create or drop-and-create-and-drop.
*/
@ConfigItem
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "create")
Optional<IndexLifecycleStrategyName> strategy;

/**
* The minimal cluster status required.
* <p>
* Must be one of: green, yellow, red.
*/
@ConfigItem
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "green")
Optional<IndexStatus> requiredStatus;

/**
* How long we should wait for the status before failing the bootstrap.
*/
@ConfigItem
// We can't set an actual default value here: see comment on this class.
@ConfigItem(defaultValueDocumentation = "10S")
Optional<Duration> requiredStatusWaitTimeout;
}
}