hackergin commented on a change in pull request #18058:
URL: https://github.com/apache/flink/pull/18058#discussion_r771811071



##########
File path: 
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/connector/elasticsearch/table/IndexGeneratorFactory.java
##########
@@ -88,6 +89,21 @@ private static IndexGenerator createRuntimeIndexGenerator(
                 index.substring(indexPrefix.length() + 
dynamicIndexPatternStr.length());
 
         final boolean isDynamicIndexWithFormat = 
indexHelper.checkIsDynamicIndexWithFormat(index);
+        final boolean isDynamicIndexWithProcTimeFormat =
+                indexHelper.checkIsDynamicIndexWithProcTimeFormat(index);
+
+        if (isDynamicIndexWithProcTimeFormat) {
+            final String dateTimeFormat =
+                    indexHelper.extractDateFormat(
+                            index, 
LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE);
+            return new AbstractTimeIndexGenerator(index, dateTimeFormat) {
+                @Override
+                public String generate(RowData row) {
+                    return 
indexPrefix.concat(LocalDateTime.now().format(dateTimeFormatter));

Review comment:
       I found we can get timezone id from  table config from 
context.getConfiguration(), What do you think about this?  And I updated the 
code. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to