From b0c6b52b457b5ea20b1fc3bf5f2be4cf67062cc0 Mon Sep 17 00:00:00 2001 From: Bill McConaghy Date: Mon, 17 Dec 2018 14:39:46 -0500 Subject: [PATCH] Fix search profiler (#27326) * fix logic for when license error shows * fix API route to work with latest hapi API --- .../plugins/searchprofiler/public/templates/index.html | 2 +- x-pack/plugins/searchprofiler/server/routes/profile.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/searchprofiler/public/templates/index.html b/x-pack/plugins/searchprofiler/public/templates/index.html index 3b9346a00829..0530413b42b0 100644 --- a/x-pack/plugins/searchprofiler/public/templates/index.html +++ b/x-pack/plugins/searchprofiler/public/templates/index.html @@ -18,7 +18,7 @@ -
+

{ + handler: async (request) => { const { callWithRequest } = server.plugins.elasticsearch.getCluster('data'); let parsed = request.payload.query; @@ -33,18 +33,18 @@ export function profileRoute(server, commonRouteConfig) { type: request.payload.type, body: parsed }; - - callWithRequest(request, 'search', body).then((resp) => { + try { + const resp = await callWithRequest(request, 'search', body); return { ok: true, resp: resp }; - }).catch((err) => { + } catch (err) { return { ok: false, err: err }; - }); + } } });