Skip to content

[BUG] _cat/indices does not honor bytes option #1459

Closed
@cinhtau

Description

@cinhtau

What is the bug?

You can pass the bytes parameter to the _cat/indices API for retrieving the values in your desired unit, here it is bytes.

GET _cat/indices?v&h=index,docs.count,pri.store.size&bytes=b

However, the pri.store.size is empty. Without the bytes option, the value is set in various units.

How can one reproduce the bug?

Example Code

        IndicesRequest indicesRequest = new IndicesRequest.Builder().
        headers("index,docs.count,pri.store.size&bytes=b").sort("creation.date").build();
        IndicesResponse indicesResponse = client.cat().indices(indicesRequest);

        String template = "Index %s has %s documents and uses %s bytes.";

        for (IndicesRecord record : indicesResponse.valueBody()) {
            String formattedString = String.format(template, record.index(),record.docsCount(),record.priStoreSize());
            System.out.println(formattedString);
        }

What is the expected behavior?

pri.store.size should not be null.

What is your host/environment?

na

Do you have any screenshots?

Without option

Index logs-001729 has 130205517 documents and uses 79.5gb bytes.
Index logs-001730 has 131095719 documents and uses 79.8gb bytes.
Index logs-001731 has 130679164 documents and uses 79.7gb bytes.
Index logs-001732 has 133664129 documents and uses 79.9gb bytes.

With option

Index logs-001729 has 130205517 documents and uses null bytes.
Index logs-001730 has 131095719 documents and uses null bytes.
Index logs-001731 has 130679164 documents and uses null bytes.
Index logs-001732 has 133664129 documents and uses null bytes.

Do you have any additional context?

na

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions