Skip to content

Commit

Permalink
HSEARCH-2456 Make ElasticsearchEnvironment.Defaults.REQUIRED_INDEX_ST…
Browse files Browse the repository at this point in the history
…ATUS an enum constant
  • Loading branch information
yrodiere committed Dec 7, 2016
1 parent 4416b58 commit 5cf3817
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Expand Up @@ -27,7 +27,7 @@ public static final class Defaults {
public static final long DISCOVERY_REFRESH_INTERVAL = 10L;
public static final IndexSchemaManagementStrategy INDEX_SCHEMA_MANAGEMENT_STRATEGY = IndexSchemaManagementStrategy.CREATE;
public static final int INDEX_MANAGEMENT_WAIT_TIMEOUT = 10_000;
public static final String REQUIRED_INDEX_STATUS = "green";
public static final ElasticsearchIndexStatus REQUIRED_INDEX_STATUS = ElasticsearchIndexStatus.GREEN;
public static final boolean REFRESH_AFTER_WRITE = false;
public static final int SCROLL_BACKTRACKING_WINDOW_SIZE = 10_000;
public static final int SCROLL_FETCH_SIZE = 1_000;
Expand Down
Expand Up @@ -156,10 +156,15 @@ private static ElasticsearchIndexStatus getRequiredIndexStatus(Properties proper
String status = ConfigurationParseHelper.getString(
properties,
ElasticsearchEnvironment.REQUIRED_INDEX_STATUS,
ElasticsearchEnvironment.Defaults.REQUIRED_INDEX_STATUS
null
);

return ElasticsearchIndexStatus.fromString( status );
if ( status == null ) {
return ElasticsearchEnvironment.Defaults.REQUIRED_INDEX_STATUS;
}
else {
return ElasticsearchIndexStatus.fromString( status );
}
}

private static boolean getRefreshAfterWrite(Properties properties) {
Expand Down
Expand Up @@ -100,7 +100,7 @@ public void registerForCleanup(String indexName) {

private void waitForIndexCreation(final String indexNameToWaitFor) throws IOException {
Builder healthBuilder = new Health.Builder()
.setParameter( "wait_for_status", ElasticsearchEnvironment.Defaults.REQUIRED_INDEX_STATUS )
.setParameter( "wait_for_status", ElasticsearchEnvironment.Defaults.REQUIRED_INDEX_STATUS.getElasticsearchString() )
.setParameter( "timeout", ElasticsearchEnvironment.Defaults.INDEX_MANAGEMENT_WAIT_TIMEOUT + "ms" );

Health health = new Health( healthBuilder ) {
Expand Down

0 comments on commit 5cf3817

Please sign in to comment.