mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
rake task for correct event statistics mapping in elastic
This commit is contained in:
parent
e930e04ed6
commit
0557cb991f
@ -334,7 +334,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
|
||||
callback(results)
|
||||
recursiveCb()
|
||||
else # palmares (ranking)
|
||||
queryElasticRanking index.es_type_key, $scope.ranking.groupCriterion, $scope.ranking.sortCriterion, index.graph.limit, (results, error) ->
|
||||
queryElasticRanking index.es_type_key, $scope.ranking.groupCriterion, $scope.ranking.sortCriterion, (results, error) ->
|
||||
if (error)
|
||||
callback([], error)
|
||||
else
|
||||
@ -373,17 +373,18 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
|
||||
|
||||
##
|
||||
# For ranking displays, run the elasticSearch query to retreive the /stats/type aggregations
|
||||
# @param esType {String} elasticSearch document type (subscription|machine|training|...)
|
||||
# @param statType {String} statistics type (year|month|hour|booking|...)
|
||||
# @param esType {string} elasticSearch document type (subscription|machine|training|...)
|
||||
# @param groupKey {string} statistics subtype or custom field
|
||||
# @param sortKey {string} statistics type or 'ca'
|
||||
# @param callback {function} function be to run after results were retrieved,
|
||||
# it will receive two parameters : results {Array}, error {String} (if any)
|
||||
##
|
||||
queryElasticRanking = (esType, groupKey, sortKey, limit, callback) ->
|
||||
queryElasticRanking = (esType, groupKey, sortKey, callback) ->
|
||||
# handle invalid callback
|
||||
if typeof(callback) != "function"
|
||||
console.error('[graphsController::queryElasticRanking] Error: invalid callback provided')
|
||||
return
|
||||
if !esType or !groupKey or !sortKey or typeof limit != 'number'
|
||||
if !esType or !groupKey or !sortKey
|
||||
callback([], '[graphsController::queryElasticRanking] Error: invalid parameters provided')
|
||||
|
||||
# run query
|
||||
|
@ -72,6 +72,28 @@ namespace :fablab do
|
||||
}
|
||||
}';`
|
||||
end
|
||||
es_add_event_filters
|
||||
end
|
||||
|
||||
desc 'add event filters to statistics'
|
||||
task es_add_event_filters: :environment do
|
||||
es_add_event_filters
|
||||
end
|
||||
|
||||
def es_add_event_filters
|
||||
`curl -XPUT http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats/event/_mapping -d '
|
||||
{
|
||||
"properties": {
|
||||
"ageRange": {
|
||||
"type": "string",
|
||||
"index" : "not_analyzed"
|
||||
},
|
||||
"eventTheme": {
|
||||
"type": "string",
|
||||
"index" : "not_analyzed"
|
||||
}
|
||||
}
|
||||
}';`
|
||||
end
|
||||
|
||||
desc "sync all/one project in elastic search index"
|
||||
|
Loading…
x
Reference in New Issue
Block a user