Commit 9c411756 authored by Valery Sizov's avatar Valery Sizov

ES: Add more rake task

parent 1921c963
...@@ -4,6 +4,8 @@ v 8.8.0 (unreleased) ...@@ -4,6 +4,8 @@ v 8.8.0 (unreleased)
- [Elastic] Database indexer prints its status - [Elastic] Database indexer prints its status
- [Elastic][Fix] Database indexer skips projects with invalid HEAD reference - [Elastic][Fix] Database indexer skips projects with invalid HEAD reference
- [Elastic] More efficient snippets search - [Elastic] More efficient snippets search
- [Elastic] Add rake task for removing all indexes
- [Elastic] Add rake task for clearing indexing status
- Set KRB5 as default clone protocol when Kerberos is enabled and user is logged in (Borja Aparicio) - Set KRB5 as default clone protocol when Kerberos is enabled and user is logged in (Borja Aparicio)
v 8.7.2 v 8.7.2
......
...@@ -103,11 +103,15 @@ namespace :gitlab do ...@@ -103,11 +103,15 @@ namespace :gitlab do
klass = model_name.constantize klass = model_name.constantize
klass.__elasticsearch__.create_index! force: true klass.__elasticsearch__.create_index! force: true
print "Reindexing #{klass} records... "
if klass == Note if klass == Note
Note.searchable.import Note.searchable.import
else else
klass.import klass.import
end end
puts "done".green
end end
desc "GitLab | Create empty Elasticsearch indexes" desc "GitLab | Create empty Elasticsearch indexes"
...@@ -122,7 +126,37 @@ namespace :gitlab do ...@@ -122,7 +126,37 @@ namespace :gitlab do
ProjectWiki, ProjectWiki,
Repository Repository
].each do |klass| ].each do |klass|
print "Creating index for #{klass}... "
klass.__elasticsearch__.create_index! klass.__elasticsearch__.create_index!
puts "done".green
end
end
desc "GitLab | Clear Elasticsearch indexing status"
task clear_index_status: :environment do
IndexStatus.destroy_all
puts "Done".green
end
desc "GitLab | Delete Elasticsearch indexes"
task delete_indexes: :environment do
[
Project,
Issue,
MergeRequest,
Snippet,
Note,
Milestone,
ProjectWiki,
Repository
].each do |klass|
print "Delete index for #{klass}... "
klass.__elasticsearch__.delete_index!
puts "done".green
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment