Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Fix index presence detection to work in ccs-only setups #28926

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
);
}
}

Expand Down