# I got a exception when i use bulk add method with es5.6.4

**URL:** <https://discuss.elastic.co/t/i-got-a-exception-when-i-use-bulk-add-method-with-es5-6-4/118995>\
**Category:** Elasticsearch\
**Created:** [February 8, 2018, 8:33am UTC](https://discuss.elastic.co/t/i-got-a-exception-when-i-use-bulk-add-method-with-es5-6-4/118995 "2018-02-08T08:33:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GygesM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gygesm/32/52823_2.png) [@GygesM](https://discuss.elastic.co/u/GygesM)\
**Post date:** [February 8, 2018, 8:33am UTC](https://discuss.elastic.co/t/i-got-a-exception-when-i-use-bulk-add-method-with-es5-6-4/118995/1 "2018-02-08T08:33:33Z")

</div>

when i use the es bulk add method , i got this exception following  
`reason=mapper [Runtime.SystemProperties.file.encoding] of different type, current_type [keyword], merged_type [ObjectMapper]]]]`

**my index settings and mappings is,**  
`"settings":{ "index.refresh_interval":"1s", "index.number_of_replicas":"'3'", "index.number_of_shards":"'3'" }, "mappings" : { "data" : { "date_detection": true, "_all": { "enabled": true }, "dynamic_templates": [{ "not_analyzed": { "match": "*", "match_mapping_type": "string", "mapping": { "type":"keyword", "index":false } }}], "properties" : { "timestamp" : { "type" : "date", "format" : "epoch_millis" } } } }`

and i use the high rest client to send the request for data.  
**my client code is**  
`public static void bulkAdd(String clusterName, Index index, JSONObject object) { long start = System.currentTimeMillis(); String indexName = getIndex(clusterName, index); BulkRequest request = new BulkRequest(); if (object.isEmpty()) { return; } RestClient restClient = getClient(); try { RestHighLevelClient client = new RestHighLevelClient(restClient); for (String key : object.keySet()) { XContentParser parser = XContentFactory.xContent(XContentType.JSON). createParser(NamedXContentRegistry.EMPTY, object.getString(key)); IndexRequest indexRequest = new IndexRequest(indexName, INDEX_TYPE,key).source(parser.map(),XContentType.JSON); request.add(indexRequest); } BulkResponse response = client.bulk(request); if (response.hasFailures()) { log.error("Get exceptions while bulkAdd index " + indexName + ": " + response.buildFailureMessage()); } log.debug("es bulkAdd ... index = " + indexName + ", count = " + object.size() + ", cost = " + (System.currentTimeMillis() - start)); } catch (IOException e) { e.printStackTrace(); } finally { releaseClient(restClient); } }`  
please help me as soon as possible, i need you help so hurry :

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 8, 2018, 8:34am UTC](https://discuss.elastic.co/t/i-got-a-exception-when-i-use-bulk-add-method-with-es5-6-4/118995/2 "2018-03-08T08:34:07Z")

</div>

Closed on March 8, 2018, 8:34am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
