@@ -103,8 +103,8 @@ private static Locale newLocale(String locale) {
103103 }
104104
105105 @ Override
106- public IngestDocument execute (IngestDocument ingestDocument ) {
107- Object obj = ingestDocument .getFieldValue (field , Object .class );
106+ public IngestDocument execute (IngestDocument document ) {
107+ Object obj = document .getFieldValue (field , Object .class );
108108 String value = null ;
109109 if (obj != null ) {
110110 // Don't use Objects.toString(...) here, because null gets changed to "null" which may confuse some date parsers
@@ -115,7 +115,7 @@ public IngestDocument execute(IngestDocument ingestDocument) {
115115 // extract the timezone and locale to use for date parsing
116116 final ZoneId documentTimezone ;
117117 final Locale documentLocale ;
118- final Map <String , Object > sourceAndMetadata = ingestDocument .getSourceAndMetadata ();
118+ final Map <String , Object > sourceAndMetadata = document .getSourceAndMetadata ();
119119 try {
120120 documentTimezone = newDateTimeZone (timezone == null ? null : timezone .newInstance (sourceAndMetadata ).execute ());
121121 documentLocale = newLocale (locale == null ? null : locale .newInstance (sourceAndMetadata ).execute ());
@@ -139,8 +139,8 @@ public IngestDocument execute(IngestDocument ingestDocument) {
139139 throw new IllegalArgumentException ("unable to parse date [" + value + "]" , lastException );
140140 }
141141
142- ingestDocument .setFieldValue (targetField , formatter .format (dateTime ));
143- return ingestDocument ;
142+ document .setFieldValue (targetField , formatter .format (dateTime ));
143+ return document ;
144144 }
145145
146146 @ Override
@@ -182,39 +182,33 @@ public Factory(ScriptService scriptService) {
182182
183183 public DateProcessor create (
184184 Map <String , Processor .Factory > registry ,
185- String processorTag ,
185+ String tag ,
186186 String description ,
187187 Map <String , Object > config ,
188188 ProjectId projectId
189189 ) throws Exception {
190- String field = ConfigurationUtils .readStringProperty (TYPE , processorTag , config , "field" );
191- String targetField = ConfigurationUtils .readStringProperty (TYPE , processorTag , config , "target_field" , DEFAULT_TARGET_FIELD );
192- String timezoneString = ConfigurationUtils .readOptionalStringProperty (TYPE , processorTag , config , "timezone" );
190+ String field = ConfigurationUtils .readStringProperty (TYPE , tag , config , "field" );
191+ String targetField = ConfigurationUtils .readStringProperty (TYPE , tag , config , "target_field" , DEFAULT_TARGET_FIELD );
192+ String timezoneString = ConfigurationUtils .readOptionalStringProperty (TYPE , tag , config , "timezone" );
193193 TemplateScript .Factory compiledTimezoneTemplate = null ;
194194 if (timezoneString != null ) {
195- compiledTimezoneTemplate = ConfigurationUtils .compileTemplate (
196- TYPE ,
197- processorTag ,
198- "timezone" ,
199- timezoneString ,
200- scriptService
201- );
195+ compiledTimezoneTemplate = ConfigurationUtils .compileTemplate (TYPE , tag , "timezone" , timezoneString , scriptService );
202196 }
203- String localeString = ConfigurationUtils .readOptionalStringProperty (TYPE , processorTag , config , "locale" );
197+ String localeString = ConfigurationUtils .readOptionalStringProperty (TYPE , tag , config , "locale" );
204198 TemplateScript .Factory compiledLocaleTemplate = null ;
205199 if (localeString != null ) {
206- compiledLocaleTemplate = ConfigurationUtils .compileTemplate (TYPE , processorTag , "locale" , localeString , scriptService );
200+ compiledLocaleTemplate = ConfigurationUtils .compileTemplate (TYPE , tag , "locale" , localeString , scriptService );
207201 }
208- List <String > formats = ConfigurationUtils .readList (TYPE , processorTag , config , "formats" );
209- String outputFormat = ConfigurationUtils .readStringProperty (TYPE , processorTag , config , "output_format" , DEFAULT_OUTPUT_FORMAT );
202+ List <String > formats = ConfigurationUtils .readList (TYPE , tag , config , "formats" );
203+ String outputFormat = ConfigurationUtils .readStringProperty (TYPE , tag , config , "output_format" , DEFAULT_OUTPUT_FORMAT );
210204 try {
211205 DateFormatter .forPattern (outputFormat );
212206 } catch (Exception e ) {
213207 throw new IllegalArgumentException ("invalid output format [" + outputFormat + "]" , e );
214208 }
215209
216210 return new DateProcessor (
217- processorTag ,
211+ tag ,
218212 description ,
219213 compiledTimezoneTemplate ,
220214 compiledLocaleTemplate ,
0 commit comments