mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[data views] Field retrieval - better handling of closed indices (#177370)
## Summary The field caps api returns an error if an index pattern matches a closed index. Now the error is handled and and an empty set is returned. Closes: https://github.com/elastic/kibana/issues/173954 --------- Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
parent
0a2730bd54
commit
9f3bab6d99
2 changed files with 19 additions and 0 deletions
|
@ -90,6 +90,10 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
|
|||
{ meta: true }
|
||||
);
|
||||
} catch (error) {
|
||||
// return an empty set for closed indices
|
||||
if (error.message.startsWith('cluster_block_exception')) {
|
||||
return { body: { indices: [], fields: {} } };
|
||||
}
|
||||
throw convertEsError(indices, error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,5 +227,20 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
})
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('returns 200 when index is closed', async () => {
|
||||
const es = getService('es');
|
||||
|
||||
await es.indices.close({ index: 'basic_index' });
|
||||
|
||||
await supertest
|
||||
.get(FIELDS_FOR_WILDCARD_PATH)
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
|
||||
.query({ pattern: 'basic_index' })
|
||||
.expect(200, {
|
||||
fields: [],
|
||||
indices: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue