# Update doc success, but can't search the doc in 6.8

**URL:** <https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489>\
**Category:** Elasticsearch\
**Created:** [December 4, 2019, 8:25am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489 "2019-12-04T08:25:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NigelZHANG](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@NigelZHANG](https://discuss.elastic.co/u/NigelZHANG)\
**Post date:** [December 4, 2019, 8:25am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489/1 "2019-12-04T08:25:37Z")

</div>

I delete the doc and force merge the index, It show the result is updated when I put the doc again, but the doc can't search. I check the es doc that tell me the doc will not delete immediately, but why I can't search it in spite of putting it again. Hope to get your help  
Below is my steps:

1. delete all docs
2. check the index doc with:  
`curl ednpoind/_cat/indices`  
result is:  
`green open n10219288_bngdnruleenesf2ter10 iREbA-D1S9GTiz-vsFVjMg 5 1 0 0 2.2kb 1.1kb`  
It show me the doc has been deleted.
3. I force merge index to confirm the doc is empty:  
`curl -XPOST endpoint/n10219288_bngdnruleenesf2ter10/_forcemerge`  
result is:  
`{"_shards":{"total":10,"successful":10,"failed":0}}`
4. get the shards info:  
`curl endpoint/_cat/shards/n10219288_bngdnruleenesf2ter10?format=json`  
result is:  
`[{"index":"n10219288_bngdnruleenesf2ter10","shard":"2","prirep":"p","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"Jr-kmy5"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"2","prirep":"r","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"dApGvYg"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"1","prirep":"r","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"Jr-kmy5"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"1","prirep":"p","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"dApGvYg"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"3","prirep":"r","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"Jr-kmy5"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"3","prirep":"p","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"dApGvYg"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"4","prirep":"p","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"Jr-kmy5"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"4","prirep":"r","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"dApGvYg"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"0","prirep":"p","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"Jr-kmy5"},{"index":"n10219288_bngdnruleenesf2ter10","shard":"0","prirep":"r","state":"STARTED","docs":"0","store":"228b","ip":"x.x.x.x","node":"dApGvYg"}]`  
The deleted doc has been force merge.
5. put doc again with go:  
`result, err := esclient.Index().Index(index).Type(indexType).Id(docId).BodyJson(dataMap).Refresh("wait_for").Do(ctx)`  
result is:  
`{Index:\"n10219288_bngdnruleenesf2ter10\", Type:\"n10219288_bngdnruleenesf2ter10_type\", Id:\"1\", Version:16, Result:\"updated\", Shards:(*elastic.shardsInfo)(0xc00059cba0), SeqNo:78, PrimaryTerm:1, Status:200, ForcedRefresh:false, Error:(*elastic.ErrorDetails)(nil)}`  
It shows the doc has been updated, but the version is 16.
6. search the doc:  
`curl endpoint/n10219288_bngdnruleenesf2ter10/n10219288_bngdnruleenesf2ter10_type/1`  
result:  
`{"_index":"n10219288_bngdnruleenesf2ter10","_type":"n10219288_bngdnruleenesf2ter10_type","_id":"1","found":false}`  
The create request show the result is "updated", but I can't search the doc.

---

<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:** [December 4, 2019, 8:52am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489/2 "2019-12-04T08:52:21Z")

</div>

Welcome!

I'm not sure to understand your scenario. Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![NigelZHANG](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@NigelZHANG](https://discuss.elastic.co/u/NigelZHANG)\
**Post date:** [December 4, 2019, 9:23am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489/4 "2019-12-04T09:23:30Z")

</div>

Thanks for your help, I update the comment.  
I create the doc again with same doc id that has been delete before.  
The create request successful and return result: "updated", but I can't get the doc with doc id.

---

<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:** [December 4, 2019, 9:36am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489/5 "2019-12-04T09:36:20Z")

</div>

Can you create a script which reproduce the problem? A script that I can run locally on my machine. As the example I shared.

---

<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:** [January 1, 2020, 9:36am UTC](https://discuss.elastic.co/t/update-doc-success-but-cant-search-the-doc-in-6-8/210489/6 "2020-01-01T09:36:25Z")

</div>

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