mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
a740e6ec24
commit
80dfdf74d1
2 changed files with 21 additions and 1 deletions
|
@ -104,6 +104,12 @@ export interface InfraDatabaseResponse {
|
|||
|
||||
export interface InfraDatabaseSearchResponse<Hit = {}, Aggregations = undefined>
|
||||
extends InfraDatabaseResponse {
|
||||
_shards: {
|
||||
total: number;
|
||||
successful: number;
|
||||
skipped: number;
|
||||
failed: number;
|
||||
};
|
||||
aggregations?: Aggregations;
|
||||
hits: {
|
||||
total: number;
|
||||
|
|
|
@ -43,7 +43,21 @@ export class InfraElasticsearchSourceStatusAdapter implements InfraSourceStatusA
|
|||
}
|
||||
|
||||
public async hasIndices(request: InfraFrameworkRequest, indexNames: string) {
|
||||
return (await this.getIndexNames(request, indexNames)).length > 0;
|
||||
return await this.framework
|
||||
.callWithRequest(request, 'search', {
|
||||
index: indexNames,
|
||||
size: 0,
|
||||
terminate_after: 1,
|
||||
})
|
||||
.then(
|
||||
response => response._shards.total > 0,
|
||||
err => {
|
||||
if (err.status === 404) {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue