1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

[ongoing] migrate es api: graphs (see FIXME)

This commit is contained in:
Sylvain 2018-06-08 17:22:03 +02:00
parent f66ca9165e
commit 38551e8ac2

View File

@ -361,7 +361,8 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
es.search es.search
"index": "stats" "index": "stats"
"type": esType "type": esType
"searchType": "count" "searchType": "query_then_fetch"
"size": 0
"stat-type": statType "stat-type": statType
"custom-query": '' "custom-query": ''
"start-date": moment($scope.datePickerStart.selected).format() "start-date": moment($scope.datePickerStart.selected).format()
@ -395,7 +396,8 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
es.search es.search
"index": "stats" "index": "stats"
"type": esType "type": esType
"searchType": "count" "searchType": "query_then_fetch"
"size": 0
"body": buildElasticAggregationsRankingQuery(groupKey, sortKey, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected)) "body": buildElasticAggregationsRankingQuery(groupKey, sortKey, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
, (error, response) -> , (error, response) ->
if (error) if (error)
@ -458,12 +460,11 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
# scale weeks on sunday as nvd3 supports only these weeks # scale weeks on sunday as nvd3 supports only these weeks
if interval == 'week' if interval == 'week'
q.aggregations.subgroups.aggregations.intervals.date_histogram['post_offset'] = '-1d' q.aggregations.subgroups.aggregations.intervals.date_histogram['offset'] = '-1d'
q.aggregations.subgroups.aggregations.intervals.date_histogram['pre_offset'] = '-1d'
# scale days to UTC time # scale days to UTC time
else if interval == 'day' else if interval == 'day'
offset = moment().utcOffset() offset = moment().utcOffset()
q.aggregations.subgroups.aggregations.intervals.date_histogram['post_offset'] = (-offset)+'m' q.aggregations.subgroups.aggregations.intervals.date_histogram['offset'] = (-offset)+'m'
q q
@ -504,7 +505,7 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
# we group the results by the custom given key (eg. by event date) # we group the results by the custom given key (eg. by event date)
q.aggregations.subgroups.terms = q.aggregations.subgroups.terms =
field: groupKey field: groupKey
size: 0 size: 2147483647 #FIXME https://github.com/elastic/elasticsearch/issues/22136
# results must be sorted and limited later by angular # results must be sorted and limited later by angular
if sortKey != 'ca' if sortKey != 'ca'