File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,15 @@ fun validateFormat(indexPatterns: List<String>): OpenSearchException? {
2424 val indexPatternFormatErrors = mutableListOf<String >()
2525 for (indexPattern in indexPatterns) {
2626 // Strip the exclusion prefix (-) if present for validation
27- val patternToValidate = if (indexPattern.startsWith(" -" )) {
27+ val isExclusionPattern = indexPattern.startsWith(" -" )
28+ val patternToValidate = if (isExclusionPattern) {
2829 indexPattern.substring(1 )
2930 } else {
3031 indexPattern
3132 }
3233
33- if (patternToValidate.isEmpty()) {
34+ // Check if exclusion pattern is empty after removing the prefix
35+ if (isExclusionPattern && patternToValidate.isEmpty()) {
3436 indexPatternFormatErrors.add(" index_pattern [$indexPattern ] must have content after '-' exclusion prefix" )
3537 }
3638 if (patternToValidate.contains(" #" )) {
You can’t perform that action at this time.
0 commit comments