You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2019/05/26 12:16:57 UTC

[pulsar] branch master updated: [pulsar-io-elastic-search] Change default document type for compliance with ES 7.x (#4322)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new a22af90  [pulsar-io-elastic-search] Change default document type for compliance with ES 7.x (#4322)
a22af90 is described below

commit a22af90629654416aa2023ccafa411ff2bfc527d
Author: Géraud Dugé de Bernonville <ge...@gmail.com>
AuthorDate: Sun May 26 14:16:51 2019 +0200

    [pulsar-io-elastic-search] Change default document type for compliance with ES 7.x (#4322)
    
    ### Motivation
    
    When running Elasticsearch sink on ES 7.0.1, message indexation fails with the following error :
    
    ```
    - Encountered exception in sink write:
    org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=Rejecting mapping update to [geoloc-pulsar] as the final mapping would have more than 1 type: [_doc, doc]]
    ```
    
    According to https://www.elastic.co/guide/en/elasticsearch/reference/6.3/removal-of-types.html#_schedule_for_removal_of_mapping_types, the recommended document type to use is `_doc`.
    
    ### Modifications
    
    Replace document type `doc` with recommended value `_doc`.
---
 .../main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java b/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java
index 9552541..58eb30a 100644
--- a/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java
+++ b/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java
@@ -61,7 +61,7 @@ import org.elasticsearch.common.xcontent.XContentType;
 )
 public class ElasticSearchSink implements Sink<byte[]> {
 
-    protected static final String DOCUMENT = "doc";
+    protected static final String DOCUMENT = "_doc";
 
     private URL url;
     private RestHighLevelClient client;