Repository: apache/seatunnel (Java)

Issue:
[Bug] [Connector-V2][ES] timestamp type conversion fails and sink stage there will be redundant "
### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.


### What happened

timestamp for es
<img width="1185" alt="时间戳转换失败" src="https://user-images.githubusercontent.com/77819741/221505816-7bcd3875-b5a9-47c0-8940-79c2498af665.png">


### SeaTunnel Version

2.3.0

### SeaTunnel Config

```conf
env {
  execution.parallelism = 8
  job.mode = "BATCH"
  job.name = "opensearch to console"
}

source {
  Elasticsearch {
    hosts = ["https://xxx:9200"]
    index = "arkime_sessions3*"
    source = ["firstPacket","event.id","event.kind","source.ip","client.nat.ip","source.port","client.nat.port","source.mac","source.hostname","destination.ip","server.nat.ip","destination.port","destination.nat.port","destination.mac","destination.hostname","client.user.name","client.user.domain","client.user.id","host.ip","suricata.alert.severity","rule.name","event.action","event.result","http.response.bytes","event.sequence","network.protocol","network.application","suricata.http.status","suricata.http.http_method","suricata.http.url","suricata.http.hostname","suricata.http.http_user_agent","http.request.referrer","user_agent.device.name","http.authTypeCnt","zeek.smb_cmd.command","file.path","threat.technique.name","related.oui","file.pe.product","suricata.flow.start","event.duration","event.type","host.geo.country_name","host.geo.region_name","host.geo.city_name","source.geo.country_name","source.geo.region_name","source.geo.city_name","source.geo.longitude","source.geo.latitude","destination.geo.country_name","destination.geo.region_name","destination.geo.city_name","destination.geo.longitude","destination.geo.latitude","event.original","network.direction","tags","event.hash"]
    username = "xxx"
    password = "xxx"
    tls_keystore_path = "opensearch.keystroe"
    tls_verify_hostname = false
  }  
}

transform {

}

sink {
    Console {}

}
```


### Running Command

```shell
bin/seatunnel.sh --config ../seatunneljob/job-es-no-transform-to-console.conf -m local
```


### Error Exception

```log
Caused by: java.time.format.DateTimeParseException: Text '1065823369239' could not be parsed at index 0
	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
	at java.time.LocalDateTime.parse(LocalDateTime.java:492)
	at org.apache.seatunnel.connectors.seatunnel.elasticsearch.serialize.source.DefaultSeaTunnelRowDeserializer.parseDate(DefaultSeaTunnelRowDeserializer.java:209)
	at org.apache.seatunnel.connectors.seatunnel.elasticsearch.serialize.source.DefaultSeaTunnelRowDeserializer.convertValue(DefaultSeaTunnelRowDeserializer.java:161)
	at org.apache.seatunnel.connectors.seatunnel.elasticsearch.serialize.source.DefaultSeaTunnelRowDeserializer.convert(DefaultSeaTunnelRowDeserializer.java:121)
	... 13 more

	at org.apache.seatunnel.engine.client.job.ClientJobProxy.waitForJobComplete(ClientJobProxy.java:118)
	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:151)
	... 2 more
```


### Flink or Spark Version

_No response_

### Java or Scala Version

_No response_

### Screenshots

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)



Discussion: I have submitted a PR #4233 



Fix (patch):
diff --git a/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/source/DefaultSeaTunnelRowDeserializer.java b/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/source/DefaultSeaTunnelRowDeserializer.java
index 0cd06dcaadc..5a4858df9be 100644
--- a/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/source/DefaultSeaTunnelRowDeserializer.java
+++ b/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/source/DefaultSeaTunnelRowDeserializer.java
@@ -21,6 +21,7 @@
 import org.apache.seatunnel.shade.com.fasterxml.jackson.core.type.TypeReference;
 import org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.seatunnel.shade.com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.seatunnel.shade.com.fasterxml.jackson.databind.node.TextNode;
 
 import org.apache.seatunnel.api.table.type.ArrayType;
 import org.apache.seatunnel.api.table.type.BasicType;
@@ -37,7 +38,9 @@
 
 import java.lang.reflect.Array;
 import java.math.BigDecimal;
+import java.time.Instant;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.Base64;
 import java.util.HashMap;
@@ -111,7 +114,12 @@ SeaTunnelRow convert(ElasticsearchRecord rowRecord) {
                 value = recursiveGet(rowRecord.getDoc(), fieldName);
                 if (value != null) {
                     seaTunnelDataType = rowTypeInfo.getFieldType(i);
-                    seaTunnelFields[i] = convertValue(seaTunnelDataType, value.toString());
+                    if (value instanceof TextNode) {
+                        seaTunnelFields[i] =
+                                convertValue(seaTunnelDataType, ((TextNode) value).textValue());
+                    } else {
+                        seaTunnelFields[i] = convertValue(seaTunnelDataType, value.toString());
+                    }
                 }
             }
         } catch (Exception ex) {
@@ -188,6 +196,13 @@ Object convertValue(SeaTunnelDataType<?> fieldType, String fieldValue)
     }
 
     private LocalDateTime parseDate(String fieldValue) {
+        // handle strings of timestamp type
+        try {
+            long ts = Long.parseLong(fieldValue);
+            return LocalDateTime.ofInstant(Instant.ofEpochMilli(ts), ZoneId.systemDefault());
+        } catch (NumberFormatException e) {
+            // no op
+        }
         String formatDate = fieldValue.replace("T", " ");
         if (fieldValue.length() == "yyyyMMdd".length()
                 || fieldValue.length() == "yyyy-MM-dd".length()) {