From 7a867983911b9157d2b616a49f2735e94417340b Mon Sep 17 00:00:00 2001 From: Yonggang Liu Date: Wed, 10 Aug 2022 13:20:16 -0400 Subject: [PATCH] CMR-8107: Updated README. --- bootstrap-app/README.md | 6 ++++++ .../src/cmr/bootstrap/data/bulk_index.clj | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bootstrap-app/README.md b/bootstrap-app/README.md index 331a993707..59adabc2d6 100644 --- a/bootstrap-app/README.md +++ b/bootstrap-app/README.md @@ -128,8 +128,14 @@ Operator can use the `start_index` parameter to index concepts with sequence num ### Bulk index concepts newer than a given date-time +For all providers and all system concepts: + curl -i -XPOST http://localhost:3006/bulk_index/after_date_time?date_time=2015-02-02T10:00:00Z" +For a given list of providers (use provider `CMR` to index all system concepts): + + curl -i -XPOST -H "Content-Type: application/json" -d '{"provider_ids": ["PROV1" "PROV2" "CMR"]}' http://localhost:3006/bulk_index/after_date_time?date_time=2015-02-02T10:00:00Z" + ### Bulk index all system concepts (tags/acls/access-groups) curl -i -XPOST http://localhost:3006/bulk_index/system_concepts diff --git a/bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj b/bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj index 1dd97d6be7..3903cb99b4 100644 --- a/bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj +++ b/bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj @@ -23,11 +23,15 @@ [cmr.oracle.connection :as oc] [cmr.transmit.config :as transmit-config])) +(def ^:private system-concept-provider + "Provider name for indexing system concepts" + "CMR") + (def ^:private elastic-http-try-count->wait-before-retry-time "A map of of the previous number of tries to communicate with Elasticsearch over http to the amount of time to wait before retrying an http request. Will stop retrying if the number of requests exceeds what is configured here. Bulk indexing is expected to succeed everytime so this is fairly - aggressive about retrying and waiting a " + aggressive about retrying and waiting." {1 100 2 1000 ;; 10 seconds @@ -204,7 +208,7 @@ "Bulk index tags, acls, and access-groups." [system start-index] (let [db (helper/get-metadata-db-db system) - provider {:provider-id "CMR"} + provider {:provider-id system-concept-provider} total (apply + (for [concept-type [:tag :acl :access-group] :let [params {:concept-type concept-type :provider-id (:provider-id provider)} @@ -278,7 +282,7 @@ [system date-time] (let [system-concept-response-map (for [concept-type [:tag :acl :access-group]] (fetch-and-index-new-concepts - system {:provider-id "CMR"} concept-type date-time)) + system {:provider-id system-concept-provider} concept-type date-time)) max-revision-date (apply util/max-compare (map :max-revision-date system-concept-response-map)) system-concept-count (reduce + (map :num-indexed system-concept-response-map))] @@ -291,7 +295,7 @@ (info (format "Indexing concepts with revision-date later than [%s] for provider [%s] started." date-time provider-id)) - (if (= "CMR" provider-id) + (if (= system-concept-provider provider-id) (let [{:keys [num-indexed]} (index-system-concepts-after-datetime system date-time)] (info (format "Indexed %d system concepts." num-indexed))) @@ -313,9 +317,9 @@ date-time provider-ids)) (let [has-cmr-provider? (or (empty? provider-ids) - (some #{"CMR"} provider-ids)) + (some #{system-concept-provider} provider-ids)) providers (if (seq provider-ids) - (map #(helper/get-provider system %) (remove #(= "CMR" %) provider-ids)) + (map #(helper/get-provider system %) (remove #(= system-concept-provider %) provider-ids)) ;; all providers (helper/get-providers system)) provider-response-map (for [provider providers