harveyyue commented on code in PR #3146:
URL:
https://github.com/apache/incubator-seatunnel/pull/3146#discussion_r1001648806
##########
seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/ElasticsearchRowSerializer.java:
##########
@@ -31,41 +38,56 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* use in elasticsearch version >= 7.*
*/
public class ElasticsearchRowSerializer implements SeaTunnelRowSerializer {
- private final SeaTunnelRowType seaTunnelRowType;
private final ObjectMapper objectMapper = new
ObjectMapper().registerModule(new JavaTimeModule())
- .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ private final SeaTunnelRowType seaTunnelRowType;
+ private final IndexInfo indexInfo;
private final IndexSerializer indexSerializer;
-
private final IndexTypeSerializer indexTypeSerializer;
+ private boolean hasKeys;
public ElasticsearchRowSerializer(ElasticsearchVersion
elasticsearchVersion, IndexInfo indexInfo, SeaTunnelRowType seaTunnelRowType) {
this.indexTypeSerializer =
IndexTypeSerializerFactory.getIndexTypeSerializer(elasticsearchVersion,
indexInfo.getType());
this.indexSerializer =
IndexSerializerFactory.getIndexSerializer(indexInfo.getIndex(),
seaTunnelRowType);
this.seaTunnelRowType = seaTunnelRowType;
+ this.indexInfo = indexInfo;
+ this.hasKeys = indexInfo.getIds() != null && indexInfo.getIds().size()
> 0 ? true : false;
Review Comment:
fixed it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]