Re: Upserts with Flink-elasticsearch

Posted by Hung on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Upserts-with-Flink-elasticsearch-tp5767p5829.html

Without indexRequest ES2 throws `document does not exist` exception.

Based on  
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update.html#java-docs-update-api-upsert 

the upsert works althrough not sure it's the best way.

return new UpdateRequest()
                .index(sample_index)
                .type(sample_type)
                .id(String.valueOf(id))
                .doc(json)
                .upsert(Requests.indexRequest()
                .index(sample_index)
                .type(sample_type)
                .id(String.valueOf(id))
                .source(json));

Cheers,

Hung