Skip to content

Commit

Permalink
remove elasticsearch package imports from reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jul 29, 2021
1 parent 12271f3 commit 8718a0a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { SearchResponse } from 'elasticsearch';
import type { estypes } from '@elastic/elasticsearch';
import { IScopedClusterClient, IUiSettingsClient } from 'src/core/server';
import { IScopedSearchClient } from 'src/plugins/data/server';
import { Datatable } from 'src/plugins/expressions/server';
Expand Down Expand Up @@ -93,7 +93,7 @@ export class CsvGenerator {
};
const results = (
await this.clients.data.search(searchParams, { strategy: ES_SEARCH_STRATEGY }).toPromise()
).rawResponse as SearchResponse<unknown>;
).rawResponse as estypes.SearchResponse<unknown>;

return results;
}
Expand All @@ -107,7 +107,7 @@ export class CsvGenerator {
scroll_id: scrollId,
},
})
).body as SearchResponse<unknown>;
).body;
return results;
}

Expand Down Expand Up @@ -321,13 +321,13 @@ export class CsvGenerator {
if (this.cancellationToken.isCancelled()) {
break;
}
let results: SearchResponse<unknown> | undefined;
let results: estypes.SearchResponse<unknown> | undefined;
if (scrollId == null) {
// open a scroll cursor in Elasticsearch
results = await this.scan(index, searchSource, scrollSettings);
scrollId = results?._scroll_id;
if (results.hits?.total != null) {
totalRecords = results.hits.total;
totalRecords = results.hits.total as number;
this.logger.debug(`Total search results: ${totalRecords}`);
}
} else {
Expand Down

0 comments on commit 8718a0a

Please sign in to comment.