-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add number_of_routing_shards config set to 30
With elastic/elasticsearch#26931 the possibility for splitting shards was introduced. To make use of this feature for indices created with ES >=6.1 the config option `index.number_of_routing_shards` is required. This adds this config option currently set to 30 as it's a multiple of 1, 3 and 5, our current number of default shards in Beats and ES. This allows users with default configs to scale their split their shards. The `number_of_routing_shards` can also be overwritten in the config file.
- Loading branch information
Showing
10 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// +build !integration | ||
|
||
package template | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNumberOfRoutingShards(t *testing.T) { | ||
|
||
beatVersion := "6.1.0" | ||
beatName := "testbeat" | ||
config := TemplateConfig{} | ||
|
||
// Test it exists in 6.1 | ||
template, err := New(beatVersion, beatName, "6.1.0", config) | ||
assert.NoError(t, err) | ||
|
||
data := template.generate(nil, nil) | ||
shards, err := data.GetValue("settings.index.number_of_routing_shards") | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, 30, shards.(int)) | ||
|
||
// Test it does not exist in 6.0 | ||
template, err = New(beatVersion, beatName, "6.0.0", config) | ||
assert.NoError(t, err) | ||
|
||
data = template.generate(nil, nil) | ||
shards, err = data.GetValue("settings.index.number_of_routing_shards") | ||
assert.Error(t, err) | ||
assert.Equal(t, nil, shards) | ||
} | ||
|
||
func TestNumberOfRoutingShardsOverwrite(t *testing.T) { | ||
|
||
beatVersion := "6.1.0" | ||
beatName := "testbeat" | ||
config := TemplateConfig{ | ||
Settings: TemplateSettings{ | ||
Index: map[string]interface{}{"number_of_routing_shards": 5}, | ||
}, | ||
} | ||
|
||
// Test it exists in 6.1 | ||
template, err := New(beatVersion, beatName, "6.1.0", config) | ||
assert.NoError(t, err) | ||
|
||
data := template.generate(nil, nil) | ||
shards, err := data.GetValue("settings.index.number_of_routing_shards") | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, 5, shards.(int)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters