How to request es data in custom request handler using courier handler in 6.4.x?


(Kwan) #1

I want to fetch es data in visualization all by myself and handle the response data
so I use custom request hander in visulization

         const customRequestHandler = async (vis, params) => {
                const { appState, searchSource, uiState, queryFilter, timeRange, filters, query } = params;
                // searchSource.setField('size', vis.params.numberOfRowsToFetch)
                const dataLoaderParams = {
                   searchSource,
                   timeRange,
                   query,
                   queryFilter,
                   filters,
                   uiState,
                   aggs: vis.getAggConfig(),
                  forceFetch: false,
                }
                const requestHandlers = Private(VisRequestHandlersRegistryProvider);
                const requestHandler = requestHandlers.find(handler => handler.name === 'courier').handler;
                return await requestHandler(vis, dataLoaderParams)
            };

but the console will print

courier.js:166 Uncaught (in promise) TypeError: Cannot read property 'reset' of undefined
    at courier.js:166

I tried but can not figure it out, I will be appreciate if you guys could give some advice
:confounded:


(Thomas Neirynck) #2

thx @Lynnic

pinging @ppisljar or @timroes as they might have some more detailed input


(Peter Pisljar) #3

your custom request handler just tries to run courier request handler ...
are you sure you want custom request handler at all then ? thats ment more for cases whre you would want to query something else (not es) ...