stats

in elasticsearch-api/lib/elasticsearch/api/actions/indices/stats.rb [61:94]


        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