     (db/save-tentacle! tentacle)
     (db/create-mapping! head tentacle)))
 
+(defn- create-fts-document-index
+  [db-name]
+  (let [update-sql "UPDATE documents SET search_vector = to_tsvector('english', name || ' ' || body)"
+        idx-sql "CREATE INDEX fts_idx ON documents USING GIN(search_vector)"]
+    (log/info "Creating FTS Index for the documents table")
+    (do-sql-with-logging! update-sql db-name)
+    (do-sql-with-logging! idx-sql db-name)
+    (log/info "Index successfully created")))
+
 (defn bootstrap
   "checks for the presence of tables and creates them if necessary"
   ([] (bootstrap :main))

   [:tentacle_name "varchar(50) references tentacles(name) on delete cascade"]
   ["PRIMARY KEY(head_name, tentacle_name)"]])

(defn do-sql-with-logging!
  [sql-statement db-name]
  (try (sql/db-do-commands (build-db-spec-by-name db-name) sql-statement)


(def table-name-schema-pairs [["heads" head-schema]
                              ["tentacles" tentacle-schema]
                              ["head_tentacle_mappings" head-tentacle-schema]
                              ["documents" document-schema]])

(defn- load-doctopus
  "On bootstrap, we want to create a Head, a Tentacle for Doctopus itself, and
