iDigBio / idigbio-search-api

Server-side code driving iDigBio's search functionality.
GNU General Public License v3.0
24 stars 5 forks source link

improve: _search Elasticsearch requests can now handle larger specified number of fields #78

Closed valdeza closed 9 months ago

valdeza commented 9 months ago

(Particularly affects logic using searchShim.js)

As it turns out, requesting 300 fields can result in a >10,000-character URL which, understandably, is met with ECONNRESET. Moving the potentially large '_source' array from URL parameters to the HTTP request body shrinks the URL back down to transmittable length.

Previously, the way these ES requests were built leads to response errors to requests for around 80–110 fields.

Reported by @mgaynor1