Skip to content

Commit 5db9207

Browse files
aeroastropicandocodigo
authored andcommitted
Stop emitting FATAL log when checking existence of indices
Passing `ignore: 404` to Elasticsearch::Client can stop FATAL log in addition to stopping exception. This option is supported since the 5.0.4 and 6.0.0 of `elasticsearch-ruby`. https://github.com/elastic/elasticsearch-ruby/blob/36d45f0c12f4e9ef96646f269748ad33b43e974c/CHANGELOG.md#600 https://github.com/elastic/elasticsearch-ruby/blob/36d45f0c12f4e9ef96646f269748ad33b43e974c/CHANGELOG.md#504 This swallowing was implemented following exception catching as follows. elastic/elasticsearch-ruby@9848c97
1 parent 65942e3 commit 5db9207

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

elasticsearch-model/lib/elasticsearch/model/indexing.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def create_index!(options={})
270270
def index_exists?(options={})
271271
target_index = options[:index] || self.index_name
272272

273-
self.client.indices.exists(index: target_index) rescue false
273+
self.client.indices.exists(index: target_index, ignore: 404)
274274
end
275275

276276
# Deletes the index with corresponding name

0 commit comments

Comments
 (0)