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:
- delete all docs
- 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. - 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}}
- 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. - 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. - 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.