Skip to content

Commit

Permalink
Explicitly sets replicas and shards to 1 for ISM history indices (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
dbbaughe committed Nov 13, 2020
1 parent c458f8c commit ca9a1d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class IndexStateManagementHistory(
val request = RolloverRequest(IndexStateManagementIndices.HISTORY_WRITE_INDEX_ALIAS, null)
request.createIndexRequest.index(IndexStateManagementIndices.HISTORY_INDEX_PATTERN)
.mapping(_DOC, IndexStateManagementIndices.indexStateManagementHistoryMappings, XContentType.JSON)
.settings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 1))
request.addMaxIndexDocsCondition(historyMaxDocs)
request.addMaxIndexAgeCondition(historyMaxAge)
val response = client.admin().indices().rolloversIndex(request).actionGet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.elasticsearch.action.support.master.AcknowledgedResponse
import org.elasticsearch.client.Client
import org.elasticsearch.client.IndicesAdminClient
import org.elasticsearch.cluster.service.ClusterService
import org.elasticsearch.common.settings.Settings
import org.elasticsearch.common.xcontent.XContentType

@OpenForTesting
Expand Down Expand Up @@ -104,6 +105,7 @@ class IndexStateManagementIndices(
if (existsResponse.isExists) return true

val request = CreateIndexRequest(index).mapping(_DOC, indexStateManagementHistoryMappings, XContentType.JSON)
.settings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 1).build())
if (alias != null) request.alias(Alias(alias))
return try {
val createIndexResponse: CreateIndexResponse = client.suspendUntil { client.create(request, it) }
Expand Down

0 comments on commit ca9a1d6

Please sign in to comment.