@@ -358,15 +358,16 @@ createSnapshot (SnapshotRepoName repoName)
358358 url = addQuery params <$> joinPath ["_snapshot", repoName, snapName]
359359 params = [("wait_for_completion", Just (boolQP snapWaitForCompletion))]
360360 body = encode $ object prs
361− prs = catMaybes [ ("indices" .=) . renderIndices <$> snapIndices
361+ prs = catMaybes [ ("indices" .=) . indexSelectionName <$> snapIndices
362362 , Just ("ignore_unavailable" .= snapIgnoreUnavailable)
363363 , Just ("ignore_global_state" .= snapIncludeGlobalState)
364364 , Just ("partial" .= snapPartial)
365365 ]
366366
367367
368−renderIndices :: NonEmpty IndexName -> Text
369−renderIndices (i :| is) = T.intercalate "," (renderIndex <$> (i:is))
368+indexSelectionName :: IndexSelection -> Text
369+indexSelectionName AllIndexes = "_all"
370+indexSelectionName (IndexList (i :| is)) = T.intercalate "," (renderIndex <$> (i:is))
370371 where
371372 renderIndex (IndexName n) = n
372373
@@ -425,15 +426,17 @@ restoreSnapshot (SnapshotRepoName repoName)
425426 url = addQuery params <$> joinPath ["_snapshot", repoName, snapName, "_restore"]
426427 params = [("wait_for_completion", Just (boolQP snapRestoreWaitForCompletion))]
427428 body = encode (object prs)
428− prs = catMaybes [ ("indices" .=) . renderIndices <$> snapRestoreIndices
429− , Just ("ignore_unavailable" .= snapRestoreIgnoreUnavailable)
430− , Just ("include_global_state" .= snapRestoreIncludeGlobalState)
431− , ("rename_pattern" .=) <$> snapRestoreRenamePattern
432− , ("rename_replacement" .=) . renderTokens <$> snapRestoreRenameReplacement
433− , Just ("include_aliases" .= snapRestoreIncludeAliases)
434− , ("index_settings" .= ) <$> snapRestoreIndexSettingsOverrides
435− , ("ignore_index_settings" .= ) <$> snapRestoreIgnoreIndexSettings
436− ]
429+
430+
431+ prs = catMaybes [ ("indices" .=) . indexSelectionName <$> snapRestoreIndices
432+ , Just ("ignore_unavailable" .= snapRestoreIgnoreUnavailable)
433+ , Just ("include_global_state" .= snapRestoreIncludeGlobalState)
434+ , ("rename_pattern" .=) <$> snapRestoreRenamePattern
435+ , ("rename_replacement" .=) . renderTokens <$> snapRestoreRenameReplacement
436+ , Just ("include_aliases" .= snapRestoreIncludeAliases)
437+ , ("index_settings" .= ) <$> snapRestoreIndexSettingsOverrides
438+ , ("ignore_index_settings" .= ) <$> snapRestoreIgnoreIndexSettings
439+ ]
437440 renderTokens (t :| ts) = mconcat (renderToken <$> (t:ts))
438441 renderToken (RRTLit t) = t
439442 renderToken RRSubWholeMatch = "$0"
@@ -522,11 +525,6 @@ optimizeIndex ixs IndexOptimizationSettings {..} =
522525 body = Nothing
523526
524527
525−-------------------------------------------------------------------------------
526−indexSelectionName :: IndexSelection -> Text
527−indexSelectionName (IndexList names) = renderIndices names
528−indexSelectionName AllIndexes = "_all"
529−
530528deepMerge :: [Object] -> Object
531529deepMerge = LS.foldl' go mempty
532530 where go acc = LS.foldl' go' acc . HM.toList