public Result widgetValue(String dashboardId, String widgetId, int resolution) {
try {
Dashboard dashboard = dashboardService.get(dashboardId);
DashboardWidget widget = dashboard.getWidget(widgetId);
DashboardWidgetValueResponse widgetValue = widget.getValue(api());
Object resultValue = (widget instanceof SearchResultChartWidget) ? filterValuesByResolution(resolution, widgetValue.result) : widgetValue.result;
Map<String, Object> result = Maps.newHashMap();
result.put("result", resultValue);
result.put("took_ms", widgetValue.tookMs);