Commit e1f3150d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '10195-docs-improve-elasticsearch-documentation' into 'master'

Update Elasticsearch docs and add "projects_not_indexed" rake task

Closes #10195

See merge request gitlab-org/gitlab-ee!9842
parents 02c63702 38ce1390
This diff is collapsed.
---
title: Added gitlab:elastic:projects_not_indexed rake task
merge_request: 9854
author: Jason Colyer
type: added
......@@ -179,6 +179,17 @@ namespace :gitlab do
puts "Done".color(:green)
end
desc "GitLab | Elasticsearch | Display which projects are not indexed"
task projects_not_indexed: :environment do
not_indexed = Project.where.not(id: IndexStatus.select(:project_id).distinct)
if not_indexed.count.zero?
puts 'All projects are currently indexed'.color(:green)
else
display_unindexed(not_indexed)
end
end
def batch_size
ENV.fetch('BATCH', 300).to_i
end
......@@ -208,5 +219,19 @@ namespace :gitlab do
projects
end
def display_unindexed(projects)
arr = if projects.count < 500 || ENV['SHOW_ALL']
projects
else
projects[1..500]
end
arr.each do |p|
puts "Project '#{p.full_path}' (ID: #{p.id}) isn't indexed.".color(:red)
end
puts "#{arr.count} out of #{projects.count} non-indexed projects shown."
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