How to introduce a new api for kibana plugin?

File name : create_index_pattern_wizards.js
to fetch all the indices
return es.search(params)

Now, I want to fetch aliases
so i wrote es.cat.aliases it did not work out
so i am trying to write an api
Code as follows

i wrote create_index_pattern_wizards.js
$http.get('../api/kibana/management/aliases').then((response) => {
this.aliases = response.data;
});

i have created a file management folder / index.js

export default function (server) {
const call = server.plugins.elasticsearch.getCluster('data').callWithRequest;
server.route({
path: '/api/kibana/management/aliases/',
method: ['GET'],
handler: (req, reply) => {
return call(req, 'cat.aliases', { format: 'json' })
.then(responseAliases => {
reply(responseAliases.map((a)=>{
return a.alias;
}));
});
}
});
}

API is getting called but returning 404

any help please

@lukas

@tylersmalley

@matw

@mikecote can we please get some help here? Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.