Background: In version 7.6.0 of ES, an external client is continuously executing update_by_query on an index.
Phenomenon: At this time, I found through /_cat/segments that the docs.count and docs.deleted of many existing segments in the index are constantly changing.
For example, the segment information is as follows
segment generation docs.count docs.deleted size size.memory committed searchable version compound
_mqg 29464 2683624 802282 2.5gb 2119594 true true 8.4.0 false
_oxd 32305 1250591 632447 1.3gb 1138511 true true 8.4.0 false
_oo5 31973 1434271 472773 1.3gb 1158523 true true 8.4.0 false
_v6k 40412 1209509 320023 1.1gb 891519 true true 8.4.0 false
_1w5 2453 539240 284964 629.9mb 584760 true true 8.4.0 false
_v0q 40202 982360 266487 929.5mb 733621 true true 8.4.0 false
_20b 2603 1367294 225623 1.1gb 1019214 true true 8.4.0 false
_bu7 15343 1144383 210547 1007.5mb 846393 true true 8.4.0 false
_733 9183 1875493 166523 1.5gb 1323250 true true 8.4.0 false
After a few seconds, the segment information is as follows
segment generation docs.count docs.deleted size size.memory committed searchable version compound
_mqg 29464 2683135 802771 2.5gb 2119594 true true 8.4.0 false
_oxd 32305 1250591 632447 1.3gb 1138511 true true 8.4.0 false
_oo5 31973 1434271 472773 1.3gb 1158523 true true 8.4.0 false
_v6k 40412 1208615 320917 1.1gb 891519 true true 8.4.0 false
_1w5 2453 537834 286370 629.9mb 584760 true true 8.4.0 false
_v0q 40202 973870 274977 929.5mb 733621 true true 8.4.0 false
_20b 2603 1361957 230960 1.1gb 1019214 true true 8.4.0 false
_bu7 15343 1144383 210547 1007.5mb 846393 true true 8.4.0 false
_733 9183 1870996 171020 1.5gb 1323250 true true 8.4.0 false
The docs.count and docs.deleted of segments such as _mqg, _v6k, _1w5, etc. have changed.
Question: I remember that the information of segments that have been flushed in Lucene is immutable, and when a segment has been flushed, new data should go to a new segment.
Why does the above phenomenon exist?