diff --git a/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/analysis-common/50_char_filters.yml b/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/analysis-common/50_char_filters.yml index 67e68428c07c7..76f17dddd3f0e 100644 --- a/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/analysis-common/50_char_filters.yml +++ b/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/analysis-common/50_char_filters.yml @@ -27,6 +27,33 @@ - length: { tokens: 1 } - match: { tokens.0.token: "replacedSample 6 sample1" } +--- +"pattern_replace error handling (too complex pattern)": + - do: + catch: bad_request + indices.create: + index: test_too_complex_regex_pattern + body: + settings: + index: + analysis: + analyzer: + my_analyzer: + tokenizer: standard + char_filter: + - my_char_filter + char_filter: + my_char_filter: + type: "pattern_replace" + # This pattern intentionally uses special characters designed to throw an error. + # It's expected that the pattern may not render correctly. + pattern: "(\\d+)-(?=\\d\nͭͭͭͭͭͭͭͭͭͭͭͭͭͭͭ" + flags: CASE_INSENSITIVE|MULTILINE|DOTALL|UNICODE_CASE|CANON_EQ + replacement: "_$1" + - match: { status: 400 } + - match: { error.type: illegal_argument_exception } + - match: { error.reason: "Too complex regex pattern" } + --- "mapping": - do: diff --git a/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/indices.analyze/10_analyze.yml b/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/indices.analyze/10_analyze.yml index 13a562d72a138..971f530cebeb5 100644 --- a/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/indices.analyze/10_analyze.yml +++ b/modules/analysis-common/src/yamlRestTest/resources/rest-api-spec/test/indices.analyze/10_analyze.yml @@ -44,32 +44,6 @@ - match: { tokens.0.token: sha } - match: { tokens.1.token: hay } ---- -"Too complex regex pattern": - - do: - catch: bad_request - indices.create: - index: test_too_complex_regex_pattern - body: - settings: - index: - analysis: - analyzer: - my_analyzer: - tokenizer: standard - char_filter: - - my_char_filter - char_filter: - my_char_filter: - type: "pattern_replace" - pattern: "(\\d+)-(?=\\d\nͭͭͭͭͭͭͭͭͭͭͭͭͭͭͭ" - flags: CASE_INSENSITIVE|MULTILINE|DOTALL|UNICODE_CASE|CANON_EQ - replacement: "_$1" - - match: { status: 400 } - - match: { error.type: illegal_argument_exception } - - match: { error.reason: "Too complex regex pattern" } - - --- "Custom normalizer in request": - do: