@searchkit/api
Advanced tools
Comparing version 4.0.0-next.11 to 4.0.0-next.12
@@ -429,3 +429,3 @@ "use strict"; | ||
const { params = {} } = request; | ||
const hitsPerPage = params.hitsPerPage || 20; | ||
const hitsPerPage = params.hitsPerPage == null ? 20 : params.hitsPerPage; | ||
return { | ||
@@ -645,3 +645,3 @@ size: hitsPerPage, | ||
const totalHits = typeof total === "number" ? total : total == null ? void 0 : total.value; | ||
const nbPages = Math.ceil((typeof total === "number" ? total : (total == null ? void 0 : total.value) || 0) / hitsPerPage); | ||
const nbPages = hitsPerPage <= 0 ? 0 : Math.ceil((typeof total === "number" ? total : (total == null ? void 0 : total.value) || 0) / hitsPerPage); | ||
return { | ||
@@ -697,3 +697,3 @@ hitsPerPage, | ||
async msearch(requests) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e, _f; | ||
try { | ||
@@ -726,5 +726,5 @@ const response = await fetch(`${this.config.host}/_msearch`, { | ||
); | ||
} else if (responses.status === 400) { | ||
} else if (responses.status === 400 || ((_f = (_e = responses.responses) == null ? void 0 : _e[0]) == null ? void 0 : _f.status) === 400) { | ||
throw new Error( | ||
"Elasticsearch Bad Request. Check your query and make sure it is valid. Turn on debug mode to see the Elasticsearch query." | ||
"Elasticsearch Bad Request. Check your query and make sure it is valid. Check the field mapping. Turn on debug mode to see the Elasticsearch query." | ||
); | ||
@@ -731,0 +731,0 @@ } |
{ | ||
"name": "@searchkit/api", | ||
"version": "4.0.0-next.11", | ||
"version": "4.0.0-next.12", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
171099