jetpumz
(jetpumz)
December 18, 2017, 1:58pm
1
So I'm trying to build a csv export feature for discover on kibana 5.5.1, I'm trying to fetch all the data from elasticsearch on backend using
export default function (server) {
server.route({
config: {
cors: {
origin: ['*'],
}
},
path: '/export',
method: 'POST',
handler: async (req, reply) => {
const dataCluster = server.plugins.elasticsearch.getCluster('data');
dataCluster.callWithRequest(req, 'search').then(res => {
console.log(res);
});
}
});
}
The thing is now I'm stuck on how to inject the request payload that kibana use in _msearch REST API so that I can inject it to backend. Anyone ?
ppisljar
(Peter Pisljar)
December 19, 2017, 11:40am
2
i don't fully understand the question, could you try explaining a bit more on what you are trying to achieve ?
thank you.
jetpumz
(jetpumz)
December 19, 2017, 1:24pm
3
Hi @ppisljar , thanks for the response !
So if you see at the picutre, I want to get the request payload dynamically that kibana sent to _msearch REST API from my custom plugin
ppisljar
(Peter Pisljar)
December 19, 2017, 1:31pm
4
how do you send the request to _msearch to kibana inside your custom plugin ? do you use SearchSource
?
jetpumz
(jetpumz)
December 19, 2017, 1:43pm
5
That's exactly my question, I'm not sure how to do it @ppisljar Is that a kibana service ?
ppisljar
(Peter Pisljar)
December 19, 2017, 1:59pm
6
we don't have any documentation on that so i would suggest to look into the SearchSource
source code (at /src/ui/public/courier/data_source/
)
you can also take a look at this PR: where i am creating a new search source and then getting the response back: https://github.com/elastic/kibana/pull/15525
I hope this is helpful, regards, Peter
jetpumz
(jetpumz)
December 19, 2017, 2:01pm
7
@ppisljar This is more than enough, thanks so much !
system
(system)
Closed
January 16, 2018, 2:01pm
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.