lib/elasticsearch/api/actions/indices/exists_index_template.rb in elasticsearch-api-7.15.0 vs lib/elasticsearch/api/actions/indices/exists_index_template.rb in elasticsearch-api-7.16.0

- old
+ new

@@ -25,11 +25,11 @@ # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) # @option arguments [Hash] :headers Custom HTTP headers # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-templates.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.16/indices-templates.html # def exists_index_template(arguments = {}) raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] headers = arguments.delete(:headers) || {} @@ -41,10 +41,14 @@ method = Elasticsearch::API::HTTP_HEAD path = "_index_template/#{Utils.__listify(_name)}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = nil - perform_request(method, path, params, body, headers).body + if Array(arguments[:ignore]).include?(404) + Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body } + else + perform_request(method, path, params, body, headers).body + end end alias_method :exists_index_template?, :exists_index_template # Register this action with its valid params when the module is loaded.