mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
Ensure elasticSearch indices are started with green status on new installations
This commit is contained in:
parent
f009988144
commit
1aad974782
@ -3,6 +3,7 @@
|
||||
## next release
|
||||
- Updated OmniAuth to fix Hashie warnings [omniauth#872](https://github.com/omniauth/omniauth/issues/872)
|
||||
- Fix a security issue: dependency loofah has a vulnerability as described in [CVE-2018-8048](https://github.com/flavorjones/loofah/issues/144)
|
||||
- Ensure elasticSearch indices are started with green status on new installations
|
||||
|
||||
## v2.6.4 2018 March 15
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Availability < ActiveRecord::Base
|
||||
after_destroy { AvailabilityIndexerWorker.perform_async(:delete, self.id) }
|
||||
|
||||
# elastic mapping
|
||||
settings do
|
||||
settings index: { number_of_replicas: 0 } do
|
||||
mappings dynamic: 'true' do
|
||||
indexes 'available_type', analyzer: 'simple'
|
||||
indexes 'subType', index: 'not_analyzed'
|
||||
|
@ -56,8 +56,8 @@ class Project < ActiveRecord::Base
|
||||
after_save { ProjectIndexerWorker.perform_async(:index, self.id) }
|
||||
after_destroy { ProjectIndexerWorker.perform_async(:delete, self.id) }
|
||||
|
||||
#
|
||||
settings do
|
||||
# mapping
|
||||
settings index: { number_of_replicas: 0 } do
|
||||
mappings dynamic: 'true' do
|
||||
indexes 'state', analyzer: 'simple'
|
||||
indexes 'tags', analyzer: Rails.application.secrets.elasticsearch_language_analyzer
|
||||
|
@ -47,7 +47,16 @@ namespace :fablab do
|
||||
`curl -XDELETE http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats`
|
||||
|
||||
puts "PUT index stats"
|
||||
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats`
|
||||
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats -d'
|
||||
{
|
||||
"settings" : {
|
||||
"index" : {
|
||||
"number_of_replicas" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
'`
|
||||
|
||||
|
||||
%w[account event machine project subscription training user space].each do |stat|
|
||||
puts "PUT Mapping stats/#{stat}"
|
||||
@ -126,7 +135,7 @@ namespace :fablab do
|
||||
client = Project.__elasticsearch__.client
|
||||
# create index if not exists
|
||||
unless client.indices.exists? index: Project.index_name
|
||||
client.indices.create Project.index_name
|
||||
Project.__elasticsearch__.create_index! force: true
|
||||
end
|
||||
# delete doctype if exists
|
||||
if client.indices.exists_type? index: Project.index_name, type: Project.document_type
|
||||
@ -150,7 +159,7 @@ namespace :fablab do
|
||||
client = Availability.__elasticsearch__.client
|
||||
# create index if not exists
|
||||
unless client.indices.exists? index: Availability.index_name
|
||||
client.indices.create Availability.index_name
|
||||
Availability.__elasticsearch__.create_index! force: true
|
||||
end
|
||||
# delete doctype if exists
|
||||
if client.indices.exists_type? index: Availability.index_name, type: Availability.document_type
|
||||
|
Loading…
x
Reference in New Issue
Block a user