Skip to content

Commit

Permalink
Stop emitting FATAL log when checking existence of indices
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aeroastro authored and picandocodigo committed Mar 1, 2021
1 parent 65942e3 commit 5db9207
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion elasticsearch-model/lib/elasticsearch/model/indexing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def create_index!(options={})
def index_exists?(options={})
target_index = options[:index] || self.index_name

self.client.indices.exists(index: target_index) rescue false
self.client.indices.exists(index: target_index, ignore: 404)
end

# Deletes the index with corresponding name
Expand Down

0 comments on commit 5db9207

Please sign in to comment.