# Mapper error on bulk insert, keyword vs text

**URL:** https://discuss.elastic.co/t/mapper-error-on-bulk-insert-keyword-vs-text/251181
**Category:** Elasticsearch
**Created:** [October 6, 2020, 7:40pm UTC](https://discuss.elastic.co/t/mapper-error-on-bulk-insert-keyword-vs-text/251181 "2020-10-06T19:40:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andrew\_DS](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Andrew\_DS](https://discuss.elastic.co/u/Andrew_DS)
#### Post date: [October 6, 2020, 7:40pm UTC](https://discuss.elastic.co/t/mapper-error-on-bulk-insert-keyword-vs-text/251181/1 "2020-10-06T19:40:03Z")

</div>

I'm getting the following error message when bulk-indexing into a new index:

```auto
[2020-10-06T00:00:00,977][DEBUG][o.e.a.b.TransportShardBulkAction] [my-node] [my-idx][1] failed to execute bulk item (index) index 
{[my-idx][_doc][_6I1-3QBQJIIxJ9GL0C8], source[n/a, actual length: [2.1kb], max length: 2kb]}
java.lang.IllegalArgumentException: mapper [additional_fields] of different type, current_type [keyword], merged_type [text]

```

I have a dynamic template mapping on this index that should cause this field to be text, but I am confused as to how I'm getting this error in the first place. If the data is coming in as a JSON String, shouldn't elasticsearch treat that as correct, regardless of whether that mapping is `keyword` or `text`? I don't understand what is causing elasticsearch to _think_ that this field might want to be a keyword.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [October 7, 2020, 7:06am UTC](https://discuss.elastic.co/t/mapper-error-on-bulk-insert-keyword-vs-text/251181/2 "2020-10-07T07:06:19Z")

</div>

Hey,

can you share a reproducible example (including index creation, mappings & sample document) as well as the Elasticsearch version you are using?

Thanks!

---

<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: [November 4, 2020, 7:06am UTC](https://discuss.elastic.co/t/mapper-error-on-bulk-insert-keyword-vs-text/251181/3 "2020-11-04T07:06:23Z")

</div>

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