Comment to clarify our empty index list fetch behavior
While this code does have test coverage that'll help prevent regressions for this implementation, it is also helpful to clarify to future developers why the request is implemented in this way to begin with.
This commit is contained in:
parent
62a93487dd
commit
36b65962a7
1 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,14 @@ define(function (require) {
|
|||
return indexList.toIndexList(timeBounds.min, timeBounds.max);
|
||||
})
|
||||
.then(function (indexList) {
|
||||
// If we've reached this point and there are no indexes in the
|
||||
// index list at all, it means that we shouldn't expect any indexes
|
||||
// to contain the documents we're looking for, so we instead
|
||||
// perform a request for an index pattern that we know will always
|
||||
// return an empty result (ie. -*). If instead we had gone ahead
|
||||
// with an msearch without any index patterns, elasticsearch would
|
||||
// handle that request by querying *all* indexes, which is the
|
||||
// opposite of what we want in this case.
|
||||
if (_.isArray(indexList) && indexList.length === 0) {
|
||||
indexList.push('-*');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue