Skip to content

Commit

Permalink
Fix index tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed May 26, 2015
1 parent 5f193bb commit 49ecfe6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject wikiparse "1.2.4"
(defproject wikiparse "1.2.5"
:description "Import Wikipedia data into elasticsearch"
:url "http://example.com/FIXME"
:aot [wikiparse.core]
Expand Down
31 changes: 16 additions & 15 deletions src/wikiparse/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@

(def connection (atom nil))

(defn tune-performance
[conn name]
(println "Tuning index performance")
(es-index/update-settings conn name {:index
{
:refresh_interval 60
:gateway {:local {:sync "60s"}}
:translog {
:interval "60s"
:flush_threshold_size "756mb"
}
} } ))

(defn connect!
"Connect once to the ES cluster"
[es]
Expand Down Expand Up @@ -200,7 +187,22 @@
(println (format "Deleting index %s" name))
(es-index/delete conn name)
(println (format "Creating index %s" name))
(es-index/create conn name :settings {:index {:number_of_shards 1, :number_of_replicas 0}} :mappings {:page page-mapping})))
(es-index/create conn name
:settings {
:index {
:number_of_shards 1,
:number_of_replicas 0
:refresh_interval 60
:gateway {:local {:sync "60s"}}
:translog {
:interval "60s"
:flush_threshold_size "756mb"
}
}
}
:mappings {
:page page-mapping
})))

(defn index-dump
[rdr conn callback phase index-name batch-size]
Expand Down Expand Up @@ -264,7 +266,6 @@
(let [[opts path] (parse-cmdline args)]
(with-connection (:es opts) conn
(ensure-index conn (:index opts))
(tune-performance conn (:index opts))
(doseq [phase (map keyword (string/split (:phases opts) #","))]
(let [stats (swap! phase-stats (fn [_] (new-phase-stats phase)))
batch-size (Integer/parseInt (:batch opts))
Expand Down

0 comments on commit 49ecfe6

Please sign in to comment.