[APM] Add rest_total_hits_as_int to all ES requests (#26462)

This commit is contained in:
Søren Louv-Jansen 2018-12-06 12:49:09 +01:00 committed by GitHub
parent 15636c4f6b
commit d3330a6ea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 1 deletions

View file

@ -63,7 +63,12 @@ export function setupRequest(req: Request): Setup {
console.log(`GET ${params.index}/_search`);
console.log(JSON.stringify(params.body, null, 4));
}
return cluster.callWithRequest(req, type, params);
const nextParams = {
...params,
rest_total_hits_as_int: true // ensure that ES returns accurate hits.total with pre-6.6 format
};
return cluster.callWithRequest(req, type, nextParams);
};
return {