Fix branch frozen indices (#29970)

* Adds frozen index param to ES queries

* Added include frozen setting to debug output

* Updates tests with new request method
This commit is contained in:
Jason Rhodes 2019-02-04 17:02:13 -05:00 committed by GitHub
parent beee5f8a0e
commit 674a6aa2ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 12 deletions

View file

@ -40,10 +40,14 @@ interface APMRequestQuery {
export function setupRequest(req: Legacy.Request): Setup {
const query = (req.query as unknown) as APMRequestQuery;
const cluster = req.server.plugins.elasticsearch.getCluster('data');
const uiSettings = req.getUiSettingsService();
const client: ESClient = async (type, params) => {
const includeFrozen = await uiSettings.get('search:includeFrozen');
const client: ESClient = (type, params) => {
if (query._debug) {
console.log(`DEBUG ES QUERY:`);
console.log({ includeFrozen });
console.log(
`${req.method.toUpperCase()} ${req.url.pathname} ${JSON.stringify(
query
@ -55,6 +59,7 @@ export function setupRequest(req: Legacy.Request): Setup {
const nextParams = {
...params,
ignore_throttled: !includeFrozen,
rest_total_hits_as_int: true // ensure that ES returns accurate hits.total with pre-6.6 format
};
return cluster.callWithRequest(req, type, nextParams);