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

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.

Welcome!

I'm not sure to understand your scenario. Could you provide a full recreation script as described in About the Elasticsearch category. 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.

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.

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

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