Method: Elasticsearch::API::Indices::Actions#stats
- Defined in:
- lib/elasticsearch/api/actions/indices/stats.rb
#stats(arguments = {}) ⇒ Object
Get index statistics. For data streams, the API retrieves statistics for the stream’s backing indices. By default, the returned statistics are index-level with primaries and total aggregations. primaries are the values for only the primary shards. total are the accumulated values for both primary and replica shards. To get shard-level statistics, set the level parameter to shards. NOTE: When moving to another node, the shard-level statistics for a shard are cleared. Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/elasticsearch/api/actions/indices/stats.rb', line 62 def stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.stats' } defined_params = [:metric, :index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _metric = arguments.delete(:metric) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index && _metric "#{Utils.listify(_index)}/_stats/#{Utils.listify(_metric)}" elsif _metric "_stats/#{Utils.listify(_metric)}" elsif _index "#{Utils.listify(_index)}/_stats" else '_stats' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |