Commit 0f999c28af3185f81846ba95bcad0c01ad285aaa

Authored by Andrew Kane
1 parent b3631cca

Improved error message for reload_synonyms with non-OSS version of Elasticsearch [skip ci]

Showing 2 changed files with 9 additions and 1 deletions   Show diff stats
CHANGELOG.md
  1 +## 4.4.1 (unreleased)
  2 +
  3 +- Improved error message for `reload_synonyms` with non-OSS version of Elasticsearch
  4 +
1 5 ## 4.4.0 (2020-06-17)
2 6  
3 7 - Added support for reloadable, multi-word, search time synonyms
... ...
lib/searchkick/index.rb
... ... @@ -180,7 +180,11 @@ module Searchkick
180 180 require "elasticsearch/xpack"
181 181 raise Error, "Requires Elasticsearch 7.3+" if Searchkick.server_below?("7.3.0")
182 182 raise Error, "Requires elasticsearch-xpack 7.8+" unless client.xpack.respond_to?(:indices)
183   - client.xpack.indices.reload_search_analyzers(index: name)
  183 + begin
  184 + client.xpack.indices.reload_search_analyzers(index: name)
  185 + rescue Elasticsearch::Transport::Transport::Errors::MethodNotAllowed
  186 + raise Error, "Requires non-OSS version of Elasticsearch"
  187 + end
184 188 end
185 189  
186 190 # queue
... ...