From 2f19fd805ead831f9656f2d598a4ba42b937c58b Mon Sep 17 00:00:00 2001 From: "Marcos G. Zimmermann" Date: Fri, 2 Aug 2024 16:05:00 -0300 Subject: [PATCH] fix: allow to pass custom options to the reset reindex parameter --- lib/esse/index/indices.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/esse/index/indices.rb b/lib/esse/index/indices.rb index 148152c..cc5bd76 100644 --- a/lib/esse/index/indices.rb +++ b/lib/esse/index/indices.rb @@ -71,6 +71,8 @@ def reset_index(suffix: index_suffix, settings: nil, optimize: true, import: tru if import import(**options, suffix: suffix, refresh: refresh) elsif reindex && (source_indexes = indices_pointing_to_alias).any? + reindex_kwargs = reindex.is_a?(Hash) ? reindex : {} + reindex_kwargs[:wait_for_completion] = true unless reindex_kwargs.key?(:wait_for_completion) source_indexes.each do |from| cluster.api.reindex(**options, body: { source: { index: from }, dest: { index: index_name(suffix: suffix) } }, refresh: refresh) end