Sha256: 9381999ee39b4ed461c25bad00e53b99a07239e9426606af7efb04b1ec08295a

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

module Elasticsearch
  module API
    module Indices
      module Actions

        # TODO: Description
        #
        # @option arguments [String] :name The name of the template (*Required*)
        # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
        #
        # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-templates.html
        #
        def exists_template(arguments={})
          raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
          valid_params = [ :local ]

          method = 'HEAD'
          path   = Utils.__pathify '_template', Utils.__escape(arguments[:name])

          params = Utils.__validate_and_extract_params arguments, valid_params
          body = nil

          perform_request(method, path, params, body).status == 200 ? true : false
        rescue Exception => e
          if e.class.to_s =~ /NotFound/ || e.message =~ /Not\s*Found|404/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.0.6 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.5 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.4 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.2 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.1 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.0 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.0.rc2 lib/elasticsearch/api/actions/indices/exists_template.rb
elasticsearch-api-1.0.0.rc1 lib/elasticsearch/api/actions/indices/exists_template.rb