How are the requestQueue populated in the source code?

Hello,

Currently, at least in Discover page, when you make a query while there is a current msearch going on, the msearch is only done for the very first query. Subsequent changes don't receive any msearch. This can be confirmed by tracking the msearch requests in your browser's development tools. I have posted a bug report about this in https://github.com/elastic/kibana/issues/15840.

I was tasked to modify (if this is the expected behaviour) or fix this. I've been looking around courier.js's fetch() function and I ended up looking at requestQueue in that gets populated when a Request object is initialized. More specifically SegmentedReq in SegmentedRequestProvider. I mentioned that since courier.fetch() fetches things that are in the requestQueue.

My problem now is when are requestQueue populated. discover.js's fetch() don't seem to do a thing in terms of populating the queue, it assumes that it is already populated by then. I also don't know who calls the callback returned by onBeginSegmentedFetch, which if called, populates the requestQueue.

Any help would be appreciated,
Cheers.

Hi @Joey_Andres,

you're not facing an easy task there. :wink: But joking aside, it the SearchRequests add themselves to the queue. As far as I understand, the request is created in the onBeginSegmentedFetch method, which is called from the discover controller.

Hello @weltenwort

I figured it out. I made a pull request at https://github.com/elastic/kibana/pull/15873. The fix should not interfere with other modules. It should only be at Discover page. I'm gonna integrate this to our instance. I'll gladly work with you folks to improve this commit.

Cheers.

Awesome, thanks a lot! :elasticheart:

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