diff --git a/middleware/api/es-search.js b/middleware/api/es-search.js index b31e31a5f2..4b73c2625d 100644 --- a/middleware/api/es-search.js +++ b/middleware/api/es-search.js @@ -15,6 +15,14 @@ function getClient() { } return new Client({ node: ELASTICSEARCH_URL, + // The default is 30,000ms but we noticed that the median time is about + // 100ms with some occasional searches taking multiple seconds. + // The default `maxRetries` is 5 which is a sensible number. + // If a query gets stuck, it's better to (relatively) quickly give up + // and retry. So if it takes longer than this time here, we're banking on + // that it was just bad luck and that it'll work if we simply try again. + // See internal issue #2318. + requestTimeout: 500, }) }