Sha256: 31c081375c429c343a3d4bbe3009adc5d9d6b479e3422e77b91dd8176dea9f19

Contents?: true

Size: 722 Bytes

Versions: 8

Compression:

Stored size: 722 Bytes

Contents

module Elasticsearch
  module API
    module Actions

      # Returns true if the cluster returns a sucessfull HTTP response, false otherwise.
      #
      # @example
      #
      #     client.ping
      #
      # @see http://elasticsearch.org/guide/
      #
      def ping(arguments={})
        method = HTTP_HEAD
        path   = ""
        params = {}
        body   = nil

        begin
          perform_request(method, path, params, body).status == 200 ? true : false
        rescue Exception => e
          if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i
            false
          else
            raise e
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
elasticsearch-api-1.1.1 lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-5.0.0 lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-5.0.0.pre lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-2.0.0 lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-1.1.0 lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-2.0.0.pre lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-1.1.pre lib/elasticsearch/api/actions/ping.rb
elasticsearch-api-1.0.18 lib/elasticsearch/api/actions/ping.rb