# ES: failed to execute bulk item (index) index {\[shakespeare\]

**URL:** <https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614>\
**Category:** Elasticsearch\
**Created:** [April 18, 2020, 5:04am UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614 "2020-04-18T05:04:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dejrgn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dejrgn/32/66568_2.png) [@Dejrgn](https://discuss.elastic.co/u/Dejrgn)\
**Post date:** [April 18, 2020, 5:04am UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/1 "2020-04-18T05:04:00Z")

</div>

(Edited: replaced pictures from outputs by formated outputs)

Hi all, first of all: I greatly appreciate it that you want to take your time to see what is going wrong in my project.  
I'm new to Elasticsearch and Kibana and I already experimented a very little bit with POST/GET/PUT-queries in ES (very basic stuff as I am new to query-language, http, and everything). Today I experimented a whole day to make exactly [this](https://www.youtube.com/watch?v=zTmfaAispIc) tutorial to work. (See also this [link](https://www.elastic.co/guide/en/kibana/current/tutorial-build-dashboard.html)).

Even though I did exactly what is done in the tutorial, I failed, I don't get it to work how it is supposed to be and I have no clue about what's going wrong & how I can solve this problem to be able to start experimenting more with Elasticsearch.

When I open Elasticsearch and execute this in Windows Powershell:

```auto
PS C:\Users\Jurgen> Invoke-RestMethod "http://localhost:9200/shakespeare/_bulk?pretty" -Method Post -ContentType 'application/x-ndjson' -InFile "shakespeare.json"

```

After waiting like 2 - 3 minutes I get this message in Windows Powershell:

```auto
   took errors items
   ---- ------ -----
1023791 True {@{index=}, @{index=}, @{index=}, @{index=}...}

```

Then, when I open my Elasticsearch screen I see many lines like these, repeating, but for different lines in the json-file, the output is extremely long, only showing a part of it:

```auto
[2020-04-18T17:52:12,066][DEBUG][o.e.a.a.i.m.p.TransportPutMappingAction] [LAPTOP-Jurgen] failed to put mappings on indices [[[shakespeare/fIJuCa76RN62H72Ga8OKUQ]]], type [line]
java.lang.IllegalArgumentException: Rejecting mapping update to [shakespeare] as the final mapping would have more than 1 type: [_doc, line]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:272) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:238) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:702) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:324) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:219) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.access$000(MasterService.java:73) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:151) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:633) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215) [elasticsearch-7.6.2.jar:7.6.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:830) [?:?]
[2020-04-18T17:52:12,066][DEBUG][o.e.a.b.TransportShardBulkAction] [LAPTOP-Jurgen] [shakespeare][0] failed to execute bulk item (index) index {[shakespeare][line][111395], source[{"line_id":111396,"play_name":"A Winters Tale","speech_number":38,"line_number":"","speaker":"LEONTES","text_entry":"Exeunt"}]}
java.lang.IllegalArgumentException: Rejecting mapping update to [shakespeare] as the final mapping would have more than 1 type: [_doc, line]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:272) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:238) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:702) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:324) ~[elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:219) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService.access$000(MasterService.java:73) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:151) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:633) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252) [elasticsearch-7.6.2.jar:7.6.2]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215) [elasticsearch-7.6.2.jar:7.6.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:830) [?:?]

```

Then, when I go to to "[http://localhost:5601](http://localhost:5601)" \> Dev Tools and I execute following Kibana input:

```auto
GET /shakespeare/_search?q=Romeo

```

Kibana returns me this output:

```auto
{
  "took" : 28,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

I expect it to be a very newbie-mistake but by far, googling my error messages didn't really get me anywhere and I also tried different ways of indexing the body of a json-file in Elasticsearch, e.g. using "Postman" instead of PowerShell but that also didn't really work...

Thanks for having a look at this.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 18, 2020, 1:14pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/2 "2020-04-18T13:14:36Z")

</div>

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with `</>` icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

---

<div class="post-metadata">

**Author:** ![Dejrgn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dejrgn/32/66568_2.png) [@Dejrgn](https://discuss.elastic.co/u/Dejrgn)\
**Post date:** [April 18, 2020, 4:15pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/3 "2020-04-18T16:15:36Z")

</div>

Thank you for your feedback. I edited my post to solve that problem.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 18, 2020, 4:51pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/4 "2020-04-18T16:51:36Z")

</div>

The error indicates that there's a line type inside the json bulk file I think.

Could you replace all `"type": "line"` by `"type": "_doc"`?  
And start again the bulk import?

---

<div class="post-metadata">

**Author:** ![Dejrgn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dejrgn/32/66568_2.png) [@Dejrgn](https://discuss.elastic.co/u/Dejrgn)\
**Post date:** [April 18, 2020, 5:07pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/5 "2020-04-18T17:07:11Z")

</div>

This is an example of a few lines from the json-file.

```auto
{"index":{"_index":"shakespeare","_type":"act","_id":0}}
{"line_id":1,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"ACT I"}
{"index":{"_index":"shakespeare","_type":"scene","_id":1}}
{"line_id":2,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"SCENE I. London. The palace."}
{"index":{"_index":"shakespeare","_type":"line","_id":2}}
{"line_id":3,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"Enter KING HENRY, LORD JOHN OF LANCASTER, the EARL of WESTMORELAND, SIR WALTER BLUNT, and others"}
{"index":{"_index":"shakespeare","_type":"line","_id":3}}

```

And this is how I creatted the mapping in Kibana, before doing the bulk import:

```auto
PUT /shakespeare
{
  "mappings": {
    "properties": {
    "speaker": {"type": "keyword"},
    "play_name": {"type": "keyword"},
    "line_id": {"type": "integer"},
    "speech_number": {"type": "integer"}
    }
  }
}

```

Thank you for taking a look at it but I don't really get which party I'll actualy need to change?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 18, 2020, 9:52pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/6 "2020-04-18T21:52:52Z")

</div>

Lines like:

```
"_type":"act"

```

Should be changed always with

```
"_type":"_doc"
```

---

<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:** [May 16, 2020, 9:52pm UTC](https://discuss.elastic.co/t/es-failed-to-execute-bulk-item-index-index-shakespeare/228614/7 "2020-05-16T21:52:57Z")

</div>

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