Skip to content

Commit

Permalink
UPSERT mode for DELETE operation not send external version
Browse files Browse the repository at this point in the history
  • Loading branch information
ramyogi7283 committed Sep 11, 2023
1 parent e4629e6 commit 8c6bac1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import java.util.List;
import java.util.Map;

import static io.confluent.connect.elasticsearch.ElasticsearchSinkConnectorConfig.WriteMethod.UPSERT;

public class DataConverter {

private static final Logger log = LoggerFactory.getLogger(DataConverter.class);
Expand Down Expand Up @@ -161,7 +163,11 @@ public DocWriteRequest<?> convertRecord(SinkRecord record, String index) {

// delete
if (record.value() == null) {
return maybeAddExternalVersioning(new DeleteRequest(index).id(id), record);
if(config.writeMethod().name().equals(UPSERT.name())) {
return new DeleteRequest(index).id(id);
}else{
return maybeAddExternalVersioning(new DeleteRequest(index).id(id), record);
}
}

String payload = getPayload(record);
Expand Down

0 comments on commit 8c6bac1

Please sign in to comment.