Why doesn't _cat/recovery honor the bytes=XX in the URI?

I'm trying to change the units for the following API call:

GET /_cat/recovery?bytes=gb

The docs around the cat API imply that you can do this, but the recovery endpoint doesn't seem to work with this. The units are always shown in bytes.

Example:

GET '_cat/recovery?bytes=gb&v&h=index,shard,time,type,stage,source_node,target_node,files,files_recovered,files_percent,bytes_total,bytes_percent' | grep -v done | head
index                             shard time  type           stage source_node     target_node     files files_recovered files_percent bytes_total  bytes_percent
filebeat-6.5.1-2019.03.06         0     2.7h  peer           index rdu-es-data-01e rdu-es-data-01b 268   262             97.8%         218212992946 85.2%
filebeat-6.5.1-2019.03.06         1     2.7h  peer           index rdu-es-data-01a rdu-es-data-01e 277   276             99.6%         228721023484 98.6%
filebeat-6.5.1-2019.03.05         1     2.1h  peer           index rdu-es-data-01d rdu-es-data-01b 271   262             96.7%         203869559392 77.1%

REF: https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html.

Which version are you using?
Do you see the same behavior with other APIs such as:

GET /_cat/indices?bytes=mb

It looks like this is an oversight in the code that serves the GET _cat/recovery API:

These values are returned as numbers, not as ByteSizeValues, so the ?bytes= parameter doesn't apply. Could you open an issue on Github, @slmingol?

1 Like

Sure thing. I confirmed that other API cmds seem to honor the bytes=X

$ GET '_cat/indices?v&bytes=gb' | head -3
health status index                             uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   f5-2019.03.12                     _XRY7YR7RGKAI73U1jy3oQ   1   1   66927007            0         39             20
green  open   syslog-2019.03.20                 QXr_EtrjROOFhCONRLY8EA   1   1  109095296            0        140             70
$ GET '_cat/indices?v&bytes=mb' | head -3
health status index                             uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   f5-2019.03.12                     _XRY7YR7RGKAI73U1jy3oQ   1   1   66927007            0      40924          20539
green  open   syslog-2019.03.20                 QXr_EtrjROOFhCONRLY8EA   1   1  109095296            0     143608          71786

Link to issue in github - https://github.com/elastic/elasticsearch/issues/40335.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.