Skip to content
Merged
5 changes: 5 additions & 0 deletions docs/changelog/123743.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 123743
summary: Adjust exception thrown when unable to load hunspell dict
area: Analysis
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,30 @@

- match: { error.type: "mapper_parsing_exception" }
- match: { error.reason: "Failed to parse mapping: The mapper type [invalid] declared on field [raw] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation." }
---
"Create index with hunspell missing dict":
- requires:
test_runner_features: [ capabilities ]
capabilities:
- method: PUT
path: /{index}
capabilities: [ hunspell_dict_400 ]
reason: "bugfix 'hunspell_dict_400' capability required"

- do:
catch: bad_request
indices.create:
index: bad_hunspell_index
body:
settings:
analysis:
analyzer:
en:
tokenizer: standard
filter:
- my_en_US_dict_stemmer
filter:
my_en_US_dict_stemmer:
type: hunspell
locale: en_US
dedup: false
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public HunspellService(final Settings settings, final Environment env, final Map
try {
return loadDictionary(locale, settings, env);
} catch (Exception e) {
throw new IllegalStateException("failed to load hunspell dictionary for locale: " + locale, e);
throw new IllegalArgumentException("failed to load hunspell dictionary for locale: " + locale, e);
}
};
if (HUNSPELL_LAZY_LOAD.get(settings) == false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ public class CreateIndexCapabilities {

private static final String NESTED_DENSE_VECTOR_SYNTHETIC_TEST = "nested_dense_vector_synthetic_test";

private static final String HUNSPELL_DICT_400 = "hunspell_dict_400";

public static final Set<String> CAPABILITIES = Set.of(
LOGSDB_INDEX_MODE_CAPABILITY,
LOOKUP_INDEX_MODE_CAPABILITY,
NESTED_DENSE_VECTOR_SYNTHETIC_TEST
NESTED_DENSE_VECTOR_SYNTHETIC_TEST,
HUNSPELL_DICT_400
);
}
Loading