Bsearch API timeout (internal server error - 500)

We are trying to implement Histogram for displaying data ingestion similar to Kibana Discover page using bsearch API.

Sometimes we are getting ID, but data is empty in the response. When we try to refetch the data without delay using the ID, we are getting an internal server error. But if we try with a delay of around 10 seconds, we are getting 200 status (sometimes id with empty data and sometimes only data).

Kibana is not facing this issue but when we are trying to use the API, we are facing this issue. Is there a way to handle this?

Response with id and no data:

FetchError: request to http://*/internal/bsearch?compress=false failed, reason: socket hang up
at ClientRequest. (
at ClientRequest.emit (node:events:518:28)
at Socket.socketOnEnd (node:_http_client:519:9)
at Socket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ECONNRESET',

Hey @Priyanka_Narne

bsearch API is marked internal and not suppose to be used externally.

If you are trying to build something externally outside the Kibana, the better option is to use the Elasticsearch Search API
You can find the ideas by looking into bsearch queries, but re-implementing Kibana internal logic might be tricky.

Best, Dima

Thank you for the reply @Dzmitry