Add query parameter "level" to the IndicesStatsRequest using the 7.17 transport client


We are using Elasticsearch 7.17 + the corresponding transport client.
I try to calculate the consumed disk space from Elasticsearch without the cat API and came up with this solution (documentation):

curl -H 'Content-type: application/json' -XGET 'http://localhost/_all/_stats/store?level=cluster'

Which works perfectly fine when using curl.

So, I want to mimic that behavior with the java transport client with the IndicesStatsRequest but it seems, the query parameter level does not exist there. All other query parameters mentioned in the documentation are present (indicesStatsRequest.fieldDataFields(), indicesStatsRequest.groups(),... to name a view)

My question is, how can add the level query parameter to the request using the java transport client?

Thanks in advance :slight_smile:

There is no level parameter in the transport protocol. You always get all the detail.

(also the transport client has been deprecated for a very long time, I recommend moving to the HTTP client)

Thank you David for clarifying. It was driving me crazy to not find the option. Now, I have the confirmation though.

Just FYI, we are in the progress of migrating to the http client, but sadly it's not so easy, given a lot of the interfaces changed or do not exist anymore :confused:

1 Like

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