Re: Flink Elasticsearch upsert document in ES

2020-02-10 Thread ORIOL LOPEZ SANCHEZ
When building the request, you should build an UpdateRequest, like the following snippet: import org.elasticsearch.action.update.UpdateRequest import org.elasticsearch.common.xcontent.XContentType val doc: String = ??? val targetIndex: String = ??? val indexType: Option[String] = ??? new Update

Re: Flink Elasticsearch upsert document in ES

2020-02-10 Thread Apoorv Upadhyay
I have tried by providing opType to elasticsearch builder, I am getting an error message "document already exists" on my console, but it still updates the value in elasticsearch val jsonString = write(record) val rqst: IndexRequest = Requests.indexRequest .index(parameter.get("esIndexName")) .

Re: Flink Elasticsearch upsert document in ES

2020-02-10 Thread Itamar Syn-Hershko
Hi ApoorvK, Elasticsearch supports "create" mode while indexing. By default indexing will overwrite documents with a the same ID, but you can tell ES to refuse overwriting. See op_type in https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#docs-index-api-query-params .