Indexes being written to are sorted to the top now

This commit is contained in:
Dionysus 2024-12-02 22:36:12 -05:00
parent 80303143ef
commit 1d08518847
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 6 additions and 1 deletions

BIN
elastop

Binary file not shown.

View File

@ -932,8 +932,13 @@ func main() {
totalSize += node.FS.Total.TotalInBytes - node.FS.Total.AvailableInBytes totalSize += node.FS.Total.TotalInBytes - node.FS.Total.AvailableInBytes
} }
// Sort indices by document count (descending) // Sort indices - active ones first, then alphabetically within each group
sort.Slice(indices, func(i, j int) bool { sort.Slice(indices, func(i, j int) bool {
// If one is active and the other isn't, active goes first
if (indices[i].indexingRate > 0) != (indices[j].indexingRate > 0) {
return indices[i].indexingRate > 0
}
// Within the same group (both active or both inactive), sort alphabetically
return indices[i].index < indices[j].index return indices[i].index < indices[j].index
}) })