From 71c068f61f4a407d5fca5c9b4a9b1a9bd2f699cf Mon Sep 17 00:00:00 2001 From: Eric Wolinetz Date: Fri, 13 Nov 2020 15:21:42 -0600 Subject: [PATCH] Updating index template logic to correctly use function to calculate primary shards instead of just counting data nodes --- pkg/k8shandler/index_management.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/k8shandler/index_management.go b/pkg/k8shandler/index_management.go index 7fdba4397..246e94e2d 100644 --- a/pkg/k8shandler/index_management.go +++ b/pkg/k8shandler/index_management.go @@ -102,7 +102,7 @@ func (er *ElasticsearchRequest) initializeIndexIfNeeded(mapping logging.IndexMan } if len(indices) < 1 { indexName := fmt.Sprintf("%s-000001", mapping.Name) - primaryShards := getDataCount(cluster) + primaryShards := int32(calculatePrimaryCount(cluster)) replicas := int32(calculateReplicaCount(cluster)) index := esapi.NewIndex(indexName, primaryShards, replicas) index.AddAlias(mapping.Name, false) @@ -129,7 +129,7 @@ func (er *ElasticsearchRequest) createOrUpdateIndexTemplate(mapping logging.Inde name := formatTemplateName(mapping.Name) pattern := fmt.Sprintf("%s*", mapping.Name) - primaryShards := getDataCount(cluster) + primaryShards := int32(calculatePrimaryCount(cluster)) replicas := int32(calculateReplicaCount(cluster)) aliases := append(mapping.Aliases, mapping.Name) template := esapi.NewIndexTemplate(pattern, aliases, primaryShards, replicas)