diff --git a/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/IndicesAdapterOS2.java b/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/IndicesAdapterOS2.java index e2724148bd76..e7a6af831e3f 100644 --- a/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/IndicesAdapterOS2.java +++ b/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/IndicesAdapterOS2.java @@ -442,7 +442,7 @@ private List> partition(final List indices) { List partition = new ArrayList<>(); int length = 0; for(String index: indices) { - if(length > MAX_INDICES_URL_PART_LENGTH) { + if(length + index.length() > MAX_INDICES_URL_PART_LENGTH) { partitions.add(partition); partition = new ArrayList<>(); }