let say I have a plugin with route:
router.post(
{
path: '/api/dashboard_real_time/create',
validate: {
body: schema.object({
fullName: schema.string(),
age: schema.number(),
status: schema.number()
})
},
},
async (context, request, response) => {
// then i wanna insert some data into elasticsearch here
return response.ok({
body: {
time: new Date().toISOString(),
},
});
}
);
I am confused to use the kibana elastic search service or data plugin or elasticsearchjs (which i have to config authentication manually).
Please give me some sample code. Thank alot!