# This writer hit an unrecoverable error; cannot merge

**URL:** <https://discuss.elastic.co/t/this-writer-hit-an-unrecoverable-error-cannot-merge/226009>\
**Category:** Elasticsearch\
**Created:** [April 1, 2020, 8:47am UTC](https://discuss.elastic.co/t/this-writer-hit-an-unrecoverable-error-cannot-merge/226009 "2020-04-01T08:47:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonysangyeop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tonysangyeop/32/65460_2.png) [@tonysangyeop](https://discuss.elastic.co/u/tonysangyeop)\
**Post date:** [April 1, 2020, 8:47am UTC](https://discuss.elastic.co/t/this-writer-hit-an-unrecoverable-error-cannot-merge/226009/1 "2020-04-01T08:47:07Z")

</div>

**Elasticsearch version : 6.1.1**

```auto
mapping => 
    "_routing" : {
       "required" : true
    }
    "join_field" : {
        "type" : "join",
        "eager_global_ordinals": true,
        "relations": {
              "questions" : "answer"
         }
     }

```

**INPUT**

```auto
    curl -XPOST localhost:9200/_bulk -H "Content-Type: application/json" -d'
{"index":{"_index":"example-v6","_type":"doc","_id":"wq_3050","routing":"questions"}}
{"type":0,"id-num":3050,"title":"elastic testing","suggest":{"input":"....test..."},"content":"ah......","directory":1,"analyzed-type":13,"location-list":[],"written-date-time":"2020.04.01 16:06:14","view-count":0,"is-deleted":false,"answer-count":0,"join_field":{"name":"question"},"adopted-date-time":null}

{"index":{"_index":"example-v6","_type":"doc","_id":"wqa_3672","routing":"questions"}}
{"type":1,"id-num":3672,"content":"en.....","written-date-time":"2020.04.01 16:07:36","is-deleted":false,"coment-count":0,"like-count":0,"join_field":{"name":"answer","parent":"wq_3050"}}'

```

**OUTPUT**

```auto
[2020-04-01T16:17:07,650][ERROR][o.e.i.e.InternalEngine$EngineMergeScheduler] [q0h0YFO] [example-v6][4] failed to merge
java.lang.IllegalStateException: this writer hit an unrecoverable error; cannot merge
	at org.apache.lucene.index.IndexWriter._mergeInit(IndexWriter.java:4193) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.IndexWriter.mergeInit(IndexWriter.java:4173) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.IndexWriter.merge(IndexWriter.java:4026) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(ConcurrentMergeScheduler.java:624) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.elasticsearch.index.engine.ElasticsearchConcurrentMergeScheduler.doMerge(ElasticsearchConcurrentMergeScheduler.java:99) ~[elasticsearch-6.1.1.jar:6.1.1]
	at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run(ConcurrentMergeScheduler.java:661) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
Caused by: java.lang.IllegalStateException: found existing value for PerFieldPostingsFormat.format, field=join_field#answer, old=Lucene50, new=Lucene50
	at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.buildFieldsGroupMapping(PerFieldPostingsFormat.java:226) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.merge(PerFieldPostingsFormat.java:152) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.SegmentMerger.mergeTerms(SegmentMerger.java:230) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:115) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.IndexWriter.mergeMiddle(IndexWriter.java:4392) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	at org.apache.lucene.index.IndexWriter.merge(IndexWriter.java:4032) ~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:12:42]
	... 3 more

```

**1. answer and question are looking at the same routing.**  
**2. answer parent is pointing at question \_id.**

_ **if I set unique \_id to each question to routing, it works well.** _

ex)

```auto
{"index":{"_index":"example-v6","_type":"doc","_id":"wq_3050","routing":"wq_3050"}}
{"type":0,"id-num":3050,"title":"elastic testing","suggest":{"input":"....test..."},"content":"ah......","directory":1,"analyzed-type":13,"location-list":[],"written-date-time":"2020.04.01 16:06:14","view-count":0,"is-deleted":false,"answer-count":0,"join_field":{"name":"question"},"adopted-date-time":null}

{"index":{"_index":"example-v6","_type":"doc","_id":"wqa_3672","routing":"wqa_3672"}}
{"type":1,"id-num":3672,"content":"dk.....","written-date-time":"2020.04.01 16:07:36","is-deleted":false,"coment-count":0,"like-count":0,"join_field":{"name":"answer","parent":"wq_3050"}}'

```

HELP ME!!!

---

<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:** [April 29, 2020, 8:47am UTC](https://discuss.elastic.co/t/this-writer-hit-an-unrecoverable-error-cannot-merge/226009/2 "2020-04-29T08:47:07Z")

</div>

Closed on April 29, 2020, 8:47am UTC

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