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:
Error:
FetchError: request to http://*/internal/bsearch?compress=false failed, reason: socket hang up
at ClientRequest. (\node_modules\node-fetch\lib\index.js:1461:11)
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',
code: 'ECONNRESET'
}