File tree 2 files changed +16
-0
lines changed
main/kotlin/org/opensearch/indexmanagement/rollup/model
test/kotlin/org/opensearch/indexmanagement/rollup/model
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
package org.opensearch.indexmanagement.rollup.model
7
7
8
+ import org.opensearch.common.settings.IndexScopedSettings
8
9
import org.opensearch.common.settings.Settings
9
10
import org.opensearch.commons.authuser.User
10
11
import org.opensearch.core.common.io.stream.StreamInput
@@ -89,6 +90,9 @@ data class Rollup(
89
90
}
90
91
}
91
92
require(sourceIndex != targetIndex) { " Your source and target index cannot be the same" }
93
+ if (targetIndexSettings != null ) {
94
+ IndexScopedSettings (null , IndexScopedSettings .BUILT_IN_INDEX_SETTINGS ).validate(targetIndexSettings, true )
95
+ }
92
96
require(dimensions.filter { it.type == Dimension .Type .DATE_HISTOGRAM }.size == 1 ) {
93
97
" Must specify precisely one date histogram dimension" // this covers empty dimensions case too
94
98
}
Original file line number Diff line number Diff line change 5
5
6
6
package org.opensearch.indexmanagement.rollup.model
7
7
8
+ import org.opensearch.common.settings.Settings
9
+ import org.opensearch.common.settings.SettingsException
8
10
import org.opensearch.indexmanagement.randomInstant
9
11
import org.opensearch.indexmanagement.randomSchedule
10
12
import org.opensearch.indexmanagement.rollup.randomDateHistogram
@@ -52,6 +54,16 @@ class RollupTests : OpenSearchTestCase() {
52
54
}
53
55
}
54
56
57
+ fun `test rollup requires correct target index settings` () {
58
+ assertFailsWith(SettingsException ::class , " Unknown property was `index.codec1`" ) {
59
+ randomRollup().copy(targetIndexSettings = Settings .builder().put(" index.codec1" , " zlib" ).build())
60
+ }
61
+
62
+ val sb = Settings .builder()
63
+ sb.put(" index.codec" , " zlib" )
64
+ randomRollup().copy(targetIndexSettings = sb.build())
65
+ }
66
+
55
67
fun `test rollup requires page size to be between 1 and 10k` () {
56
68
assertFailsWith(IllegalArgumentException ::class , " Page size was negative" ) {
57
69
randomRollup().copy(pageSize = - 1 )
You can’t perform that action at this time.
0 commit comments