mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
Issue deprecation warnings when preconfigured delimited_payload_filter is used (#43684)
#26625 deprecated delimited_payload_filter and added tests to check that warnings would be emitted when both a normal and pre-configured filter were used. Unfortunately, due to a bug in the Analyze API, the pre- configured filter check was never actually triggered, and it turns out that the deprecation warning was not in fact being emitted in this case. #43568 fixed the Analyze API bug, which then surfaced this on backport. This commit ensures that the preconfigured filter also emits the warnings and triggers an error if a new index tries to use a preconfigured delimited_payload_filter
This commit is contained in:
parent
8ff5519b11
commit
4882b932d8
@ -405,10 +405,18 @@ public class CommonAnalysisPlugin extends Plugin implements AnalysisPlugin, Scri
|
||||
input -> new CommonGramsFilter(input, CharArraySet.EMPTY_SET)));
|
||||
filters.add(PreConfiguredTokenFilter.singleton("czech_stem", false, CzechStemFilter::new));
|
||||
filters.add(PreConfiguredTokenFilter.singleton("decimal_digit", true, DecimalDigitFilter::new));
|
||||
filters.add(PreConfiguredTokenFilter.singleton("delimited_payload_filter", false, input ->
|
||||
new DelimitedPayloadTokenFilter(input,
|
||||
DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER,
|
||||
DelimitedPayloadTokenFilterFactory.DEFAULT_ENCODER)));
|
||||
filters.add(PreConfiguredTokenFilter.singletonWithVersion("delimited_payload_filter", false, (input, version) -> {
|
||||
if (version.onOrAfter(Version.V_7_0_0)) {
|
||||
throw new IllegalArgumentException(
|
||||
"[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead");
|
||||
}
|
||||
if (version.onOrAfter(Version.V_6_2_0)) {
|
||||
deprecationLogger.deprecated("Deprecated [delimited_payload_filter] used, replaced by [delimited_payload]");
|
||||
}
|
||||
return new DelimitedPayloadTokenFilter(input,
|
||||
DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER,
|
||||
DelimitedPayloadTokenFilterFactory.DEFAULT_ENCODER);
|
||||
}));
|
||||
filters.add(PreConfiguredTokenFilter.singleton("delimited_payload", false, input ->
|
||||
new DelimitedPayloadTokenFilter(input,
|
||||
DelimitedPayloadTokenFilterFactory.DEFAULT_DELIMITER,
|
||||
|
Loading…
x
Reference in New Issue
Block a user