Sha256: 67cda6653ac459c90b2840af88b9e1b05996406849cb036d8428b7241f4cd9b2
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
module Elasticsearch module API module Indices module Actions # Return true if the specified type exists, false otherwise. # # @option arguments [List] :index A comma-separated list of index names; use `_all` # to check the types across all indices (*Required*) # @option arguments [List] :type A comma-separated list of document types to check (*Required*) # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore `missing` ones # (options: none, missing) # # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/ # def exists_type(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] method = 'HEAD' path = Utils.__pathify( Utils.__listify(arguments[:index]), arguments[:type] ) params = arguments.select do |k,v| [ :ignore_indices ].include?(k) end # Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour params = Hash[params] unless params.is_a?(Hash) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elasticsearch-api-0.4.0 | lib/elasticsearch/api/actions/indices/exists_type.rb |
elasticsearch-api-0.0.2 | lib/elasticsearch/api/actions/indices/exists_type.rb |