我在弹性搜索中有几个索引,其中一个只有大约 100 个文档,但它必须每隔一秒更新一次。
结果GET _cat/indices
如下:
green open index1 8naYU5e-R-iHvfSKnrEiGw 1 0 2 9 25.5kb 25.5kb
yellow open index2 ZPQWzY7VRYGnBG0i6AL5ag 5 1 5658 89 1.2mb 1.2mb
yellow open index3 MTIDbt4uQbOv4K-0uuyOKA 5 1 0 0 1.1kb 1.1kb
yellow open index4 laF0UcIYTFKQQ6bB9dtQyw 5 1 0 0 1.1kb 1.1kb
yellow open index5 d5SYGXhYTPiVH_GKSA47lQ 5 1 0 0 1.1kb 1.1kb
yellow open index6 nIiNMwNWRZu-aISdLWa8ZA 5 1 110964 61 16.1mb 16.1mb
yellow open index7 g492XL4ZRKy4NOIBwF1yzA 5 1 111054 352 12.5mb 12.5mb
yellow open index8 C2g2RI_oQaOxUvpbzSnVIQ 5 1 123 400 484.8kb 484.8kb
如您所见,index7 中只有 123 个文档,并且在磁盘上占用的空间不应超过 500kb。
但结果du -sh ./*
是这样的:
128K ./8naYU5e-R-iHvfSKnrEiGw
1.5G ./C2g2RI_oQaOxUvpbzSnVIQ
172K ./d5SYGXhYTPiVH_GKSA47lQ
1.1G ./g492XL4ZRKy4NOIBwF1yzA
172K ./laF0UcIYTFKQQ6bB9dtQyw
172K ./MTIDbt4uQbOv4K-0uuyOKA
424M ./nIiNMwNWRZu-aISdLWa8ZA
276M ./ZPQWzY7VRYGnBG0i6AL5ag
它占用了超过 1GB 的磁盘空间。
我的问题是为什么以及如何解决它?
我在 Ubuntu 16.04 上使用 elasticsearch 6.2.4
更新
的结果du -sh ./g492XL4ZRKy4NOIBwF1yzA/*
3.2M ./indices/g492XL4ZRKy4NOIBwF1yzA/0/index
8.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/0/_state
241M ./indices/g492XL4ZRKy4NOIBwF1yzA/0/translog
3.1M ./indices/g492XL4ZRKy4NOIBwF1yzA/1/index
8.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/1/_state
238M ./indices/g492XL4ZRKy4NOIBwF1yzA/1/translog
3.2M ./indices/g492XL4ZRKy4NOIBwF1yzA/2/index
8.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/2/_state
241M ./indices/g492XL4ZRKy4NOIBwF1yzA/2/translog
3.1M ./indices/g492XL4ZRKy4NOIBwF1yzA/3/index
8.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/3/_state
241M ./indices/g492XL4ZRKy4NOIBwF1yzA/3/translog
3.1M ./indices/g492XL4ZRKy4NOIBwF1yzA/4/index
8.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/4/_state
241M ./indices/g492XL4ZRKy4NOIBwF1yzA/4/translog
4.0K ./indices/g492XL4ZRKy4NOIBwF1yzA/_state/state-4.st