Skip to content

Instantly share code, notes, and snippets.

@mbklein
Created September 28, 2020 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbklein/2cfa3f29d406fa89ea797c72b389605e to your computer and use it in GitHub Desktop.
Save mbklein/2cfa3f29d406fa89ea797c72b389605e to your computer and use it in GitHub Desktop.
def recommon
query = {"size" => 1000, "query"=>{"bool"=>{"must"=>[{"match"=>{"model.name"=>"FileSet"}}], "must_not"=>{"exists"=>{"field"=>"simple_title"}}}}}
result = CommonIndexer.client.search(body: query)
while result['hits']['hits'].length > 0
result['hits']['hits'].each do |hit|
fs = FileSet.find(hit['_id'])
fs.update_common_index
$stderr.print('.')
end
result = CommonIndexer.client.search(body: query)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment