1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

spaces stats index in elastic

This commit is contained in:
Sylvain 2017-02-28 17:49:19 +01:00
parent 4a9fb5855f
commit 2419a96010
2 changed files with 27 additions and 1 deletions

View File

@ -11,6 +11,7 @@
- Fix a bug: unable to delete an administrator from the system
- [TODO DEPLOY] `rake db:migrate`, then `rake db:seed`
- [TODO DEPLOY] add the `FABLAB_WITHOUT_SPACES` environment variable
- [TODO DEPLOY] `rake fablab:es_add_spaces`
## v2.4.10 2017 January 9

View File

@ -49,7 +49,7 @@ namespace :fablab do
puts "PUT index stats"
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats`
%w[account event machine project subscription training user].each do |stat|
%w[account event machine project subscription training user space].each do |stat|
puts "PUT Mapping stats/#{stat}"
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats/#{stat}/_mapping -d '
{
@ -96,6 +96,31 @@ namespace :fablab do
}';`
end
desc 'add spaces reservations to statistics'
task es_add_spaces: :environment do
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats/space/_mapping -d '
{
"properties": {
"type": {
"type": "string",
"index" : "not_analyzed"
},
"subType": {
"type": "string",
"index" : "not_analyzed"
},
"date": {
"type": "date"
},
"name": {
"type": "string",
"index" : "not_analyzed"
}
}
}';`
end
desc 'sync all/one project in ElasticSearch index'
task :es_build_projects_index, [:id] => :environment do |task, args|
client = Project.__elasticsearch__.client