|
11 | 11 | [cmr.system-int-test.utils.url-helper :as url] |
12 | 12 | [cmr.transmit.config :as transmit-config])) |
13 | 13 |
|
14 | | -(defn refresh-elastic-index |
| 14 | +(defn refresh-all-elastic-indexes |
15 | 15 | [] |
16 | | - (client/post (url/elastic-refresh-url) {:connection-manager (s/conn-mgr)})) |
| 16 | + (client/post (url/elastic-refresh-url cmr.elastic-utils.config/gran-elastic-name) {:connection-manager (s/conn-mgr)}) |
| 17 | + (client/post (url/elastic-refresh-url cmr.elastic-utils.config/non-gran-elastic-name) {:connection-manager (s/conn-mgr)})) |
17 | 18 |
|
18 | 19 | (defn wait-until-indexed |
19 | 20 | "Wait until ingested concepts have been indexed" |
20 | 21 | [] |
21 | 22 | (qb-side-api/wait-for-terminal-states) |
22 | | - (refresh-elastic-index)) |
| 23 | + (refresh-all-elastic-indexes)) |
23 | 24 |
|
24 | 25 | (defn full-refresh-collection-granule-aggregate-cache |
25 | 26 | "Triggers a full refresh of the collection granule aggregate cache in the indexer." |
|
99 | 100 | :query-params query-params})] |
100 | 101 | response))) |
101 | 102 |
|
| 103 | +;; TODO 10636 - just a note that type-name is not used in this func... |
102 | 104 | (defn doc-present? |
103 | 105 | "If doc is present return true, otherwise return false" |
104 | | - [index-name type-name doc-id] |
| 106 | + [index-name type-name doc-id elastic-name] |
105 | 107 | (let [response (client/get |
106 | | - (format "%s/%s/_doc/_search?q=_id:%s" (url/elastic-root) index-name doc-id) |
| 108 | + (format "%s/%s/_doc/_search?q=_id:%s" (url/elastic-root elastic-name) index-name doc-id) |
107 | 109 | {:throw-exceptions false |
108 | 110 | :connection-manager (s/conn-mgr)}) |
109 | 111 | body (json/decode (:body response) true)] |
|
143 | 145 | (qb-side-api/set-message-queue-retry-behavior 0) |
144 | 146 | (qb-side-api/set-message-queue-publish-timeout 10000)))))) |
145 | 147 |
|
146 | | -(defn delete-elasticsearch-index |
147 | | - "Helper to delete an elasticsearch index associated with a collection." |
| 148 | +(defn delete-gran-elastic-index |
| 149 | + "Helper will delete the elasticsearch granule index associated with a collection." |
148 | 150 | [coll] |
149 | 151 | (let [index-name (string/replace (format "1_%s" (string/lower-case (:concept-id coll))) |
150 | 152 | #"-" "_")] |
151 | 153 | (warn "Deleting index " index-name) |
152 | | - (client/delete (format "%s/%s" (url/elastic-root) index-name) |
| 154 | + (client/delete (format "%s/%s" (url/elastic-root cmr.elastic-utils.config/gran-elastic-name) index-name) |
153 | 155 | {:connection-manager (s/conn-mgr)}))) |
154 | 156 |
|
155 | 157 | (defn- query-for-granules-by-collection |
|
162 | 164 | {:match_all {}} |
163 | 165 | :filter {:term {:collection-concept-id-doc-values (:concept-id coll)}}}}})) |
164 | 166 |
|
165 | | -(defn delete-granules-from-small-collections |
| 167 | +(defn delete-granules-from-small-collections-elastic-index |
166 | 168 | "Helper to delete granules from the small collections index for the given collection." |
167 | 169 | [coll] |
168 | | - (client/post (format "%s/1_small_collections/_delete_by_query" (url/elastic-root)) |
| 170 | + (client/post (format "%s/1_small_collections/_delete_by_query" (url/elastic-root cmr.elastic-utils.config/gran-elastic-name)) |
169 | 171 | {:connection-manager (s/conn-mgr) |
170 | 172 | :body (query-for-granules-by-collection coll) |
171 | 173 | :content-type "application/json"})) |
172 | 174 |
|
173 | | -(defn check-index-exists |
174 | | - "Helpper to check if elasticsearch index exists." |
| 175 | +(defn gran-elastic-index-exists? |
| 176 | + "Helper to check if elasticsearch granule index exists." |
175 | 177 | [coll] |
176 | 178 | (let [index-name (string/replace (format "1_%s" (string/lower-case (:concept-id coll))) |
177 | 179 | #"-" "_")] |
178 | | - (client/head (format "%s/%s" (url/elastic-root) index-name) |
| 180 | + (client/head (format "%s/%s" (url/elastic-root cmr.elastic-utils.config/gran-elastic-name) index-name) |
179 | 181 | {:connection-manager (s/conn-mgr) |
180 | 182 | :throw-exceptions false}))) |
0 commit comments