Skip to content

Commit ca9667b

Browse files
committed
check index creation was successful
1 parent d52e940 commit ca9667b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎indexer-app/src/cmr/indexer/data/index_set_elasticsearch.clj‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,13 @@
225225
;; create new index with same orig mapping but updated shard count
226226
(try
227227
(info "Now creating empty index: " new-index " which is copy of index:" orig-index)
228-
(esi-helper/create conn new-index {:settings updated-settings
229-
:mappings mappings})
228+
(let [index-create-resp (esi-helper/create conn new-index {:settings updated-settings
229+
:mappings mappings})
230+
success-msg (:acknowledged index-create-resp)]
231+
(if-not (= true success-msg)
232+
(errors/throw-service-error
233+
:internal-error
234+
(format "error returned from elastic that the index was not created."))))
230235
(catch clojure.lang.ExceptionInfo e
231236
(let [body (cheshire/decode (get-in (ex-data e) [:body]) true)
232237
error-message (:error body)]

0 commit comments

Comments
 (0)