# Why translog\_ops still greater than 0 after flush

**URL:** <https://discuss.elastic.co/t/why-translog-ops-still-greater-than-0-after-flush/322095>\
**Category:** Elasticsearch\
**Created:** [December 28, 2022, 12:15pm UTC](https://discuss.elastic.co/t/why-translog-ops-still-greater-than-0-after-flush/322095 "2022-12-28T12:15:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DJ\_Zhu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dj_zhu/32/99543_2.png) [@DJ\_Zhu](https://discuss.elastic.co/u/DJ_Zhu)\
**Post date:** [December 28, 2022, 12:15pm UTC](https://discuss.elastic.co/t/why-translog-ops-still-greater-than-0-after-flush/322095/1 "2022-12-28T12:15:25Z")

</div>

I want to move shards between different kind of nodes in my cluster.

First, I stop write any docs into index and invoked `POST my_idx/_flush` to commit translog to lucene.  
Then change the `index.routing.allocation.require` to move shards to target node.

In my expectation, it shoud have no more translog to operation during recovery since I have invoke flush already. However, `_cat/recovery` shows there still some translog\_ops to play:

```shell
GET _cat/recovery/my_idx?v&h=i,s,t,ty,st,shost,thost,f,fp,b,bp,to,top

i s t ty st shost thost f fp b bp to top
my_idx 0 1.6m peer done 10.116.9.117 10.116.13.71 12 100.0% 137420564 100.0% 5924976 100.0%
my_idx 1 1.2m peer done 10.116.24.41 10.116.13.174 12 100.0% 137853417 100.0% 5924324 100.0%

```

What is there difference here?

Thanks.

---

<div class="post-metadata">

**Author:** ![DJ\_Zhu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dj_zhu/32/99543_2.png) [@DJ\_Zhu](https://discuss.elastic.co/u/DJ_Zhu)\
**Post date:** [January 9, 2023, 6:26am UTC](https://discuss.elastic.co/t/why-translog-ops-still-greater-than-0-after-flush/322095/2 "2023-01-09T06:26:53Z")

</div>

Seems `translog_ops` is the operation records store in translog files. During the recovery stage, source node will transfer all the translog file remains in disk to target node which will replay all the data operations if need.

Different from my early guess, `_flush` api does just sync data from translog to lucene index, but not necessary to delete old translog file. When and which translog to delete is determine by [Translog retention](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/index-modules-translog.html).

---

<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:** [February 6, 2023, 6:27am UTC](https://discuss.elastic.co/t/why-translog-ops-still-greater-than-0-after-flush/322095/3 "2023-02-06T06:27:23Z")

</div>

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