wuchong commented on a change in pull request #11466:  [FLINK-15400][connectors 
/ elasticsearch] elasticsearch table sink support dynamic index.
URL: https://github.com/apache/flink/pull/11466#discussion_r399020861
 
 

 ##########
 File path: 
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/IndexFormatter.java
 ##########
 @@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.connectors.elasticsearch;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.types.Row;
+
+import java.io.Serializable;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+/**
+ * User can use {@link IndexFormatter} to format index value from index 
pattern.
+ *
+ * <p>If the index is a dynamic index, the index pattern include general 
pattern like
+ * 'connector.index'='my-index-{item}' and time extract pattern like 
'connector.index'='my-index-{log_ts|yyyy-MM-dd}'.
+ *
+ * <p>For general pattern:
+ * 'item' is the index field comes from any DataType column.
+ *
+ * <p>For time extract pattern:
+ * 'log_ts' is the index field comes from a BIGINT/SQL_TIMESTAMP/SQL_DATE 
column.
+ * 'yyyy-MM-dd' is the date format follows the {@link DateTimeFormatter} 
syntax.
+ * '{log_ts|yyyy-MM-dd}' is the time extract pattern for index in a dynamic 
index pattern.
+ */
+@Internal
+public class IndexFormatter implements Serializable {
 
 Review comment:
   Please add `serialVersionUID` .

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to