@@ -771,28 +771,13 @@ public Iterator<Setting<?>> settings() {
771
771
Property .Final
772
772
);
773
773
774
- public static final String SETTING_INGESTION_SOURCE_ERROR_STRATEGY = "index.ingestion_source.error.strategy " ;
775
- public static final Setting <String > INGESTION_SOURCE_ERROR_STRATEGY_SETTING = Setting . simpleString (
774
+ public static final String SETTING_INGESTION_SOURCE_ERROR_STRATEGY = "index.ingestion_source.error_strategy " ;
775
+ public static final Setting <IngestionErrorStrategy . ErrorStrategy > INGESTION_SOURCE_ERROR_STRATEGY_SETTING = new Setting <> (
776
776
SETTING_INGESTION_SOURCE_ERROR_STRATEGY ,
777
777
IngestionErrorStrategy .ErrorStrategy .DROP .name (),
778
- new Setting .Validator <>() {
779
-
780
- @ Override
781
- public void validate (final String value ) {
782
- try {
783
- IngestionErrorStrategy .ErrorStrategy .valueOf (value .toUpperCase (Locale .ROOT ));
784
- } catch (IllegalArgumentException e ) {
785
- throw new IllegalArgumentException ("Invalid value for " + SETTING_INGESTION_SOURCE_ERROR_STRATEGY + " [" + value + "]" );
786
- }
787
- }
788
-
789
- @ Override
790
- public void validate (final String value , final Map <Setting <?>, Object > settings ) {
791
- validate (value );
792
- }
793
- },
794
- Property .IndexScope ,
795
- Property .Dynamic
778
+ IngestionErrorStrategy .ErrorStrategy ::parseFromString ,
779
+ (errorStrategy ) -> {},
780
+ Property .IndexScope
796
781
);
797
782
798
783
public static final Setting .AffixSetting <Object > INGESTION_SOURCE_PARAMS_SETTING = Setting .prefixKeySetting (
@@ -1030,10 +1015,7 @@ public IngestionSource getIngestionSource() {
1030
1015
pointerInitResetValue
1031
1016
);
1032
1017
1033
- final String errorStrategyString = INGESTION_SOURCE_ERROR_STRATEGY_SETTING .get (settings );
1034
- IngestionErrorStrategy .ErrorStrategy errorStrategy = IngestionErrorStrategy .ErrorStrategy .valueOf (
1035
- errorStrategyString .toUpperCase (Locale .ROOT )
1036
- );
1018
+ final IngestionErrorStrategy .ErrorStrategy errorStrategy = INGESTION_SOURCE_ERROR_STRATEGY_SETTING .get (settings );
1037
1019
final Map <String , Object > ingestionSourceParams = INGESTION_SOURCE_PARAMS_SETTING .getAsMap (settings );
1038
1020
return new IngestionSource (ingestionSourceType , pointerInitReset , errorStrategy , ingestionSourceParams );
1039
1021
}
0 commit comments