mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
parent
b8fcf06336
commit
ea7df636a9
2 changed files with 11 additions and 0 deletions
|
@ -19,6 +19,12 @@ describe('getIndices', () => {
|
|||
expect((await getIndices(null, '*:')).length).toBe(0);
|
||||
});
|
||||
|
||||
it('should ignore a single comma', async () => {
|
||||
expect((await getIndices(null, ',')).length).toBe(0);
|
||||
expect((await getIndices(null, ',*')).length).toBe(0);
|
||||
expect((await getIndices(null, ',foobar')).length).toBe(0);
|
||||
});
|
||||
|
||||
it('should trim the input', async () => {
|
||||
let index;
|
||||
const es = {
|
||||
|
|
|
@ -16,6 +16,11 @@ export async function getIndices(es, rawPattern, limit) {
|
|||
return [];
|
||||
}
|
||||
|
||||
// ES does not like just a `,*` and will throw a `[string_index_out_of_bounds_exception] String index out of range: 0`
|
||||
if (pattern.startsWith(',')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// We need to always provide a limit and not rely on the default
|
||||
if (!limit) {
|
||||
throw '`getIndices()` was called without the required `limit` parameter.';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue