Ensure we always send a comma delimited index to support commas in index patterns (#17173)

* Ensure we always send a comma delimited index

* Get visualizations working for index patterns with commas

* Fix test failures
This commit is contained in:
Chris Roberson 2018-05-09 16:45:44 -04:00
parent 958f959eb3
commit f3c011d12e
3 changed files with 5 additions and 6 deletions

View file

@ -88,7 +88,7 @@ export function SegmentedRequestProvider(Private, timefilter, config) {
const indexCount = Math.max(1, Math.floor(this._queue.length / remainingSegments));
const indices = this._active = this._queue.splice(0, indexCount);
params.index = _.pluck(indices, 'index');
params.index = indices.map(({ index }) => index).join(',');
if (_.isNumber(this._desiredSize)) {
params.body.size = this._pickSizeForIndices(indices);

View file

@ -346,8 +346,7 @@ describe('index pattern', function () {
it('is fulfilled by the result of interval toIndexList', async function () {
const indexList = await indexPattern.toIndexList();
expect(indexList[0]).to.equal('foo');
expect(indexList[1]).to.equal('bar');
expect(indexList).to.equal('foo,bar');
});
describe('with sort order', function () {
@ -372,7 +371,7 @@ describe('index pattern', function () {
it('is fulfilled using the id', async function () {
const indexList = await indexPattern.toIndexList();
expect(indexList).to.eql([indexPattern.title]);
expect(indexList).to.eql(indexPattern.title);
});
});
@ -387,7 +386,7 @@ describe('index pattern', function () {
it('is fulfilled by id', async function () {
const indexList = await indexPattern.toIndexList();
expect(indexList).to.eql([indexPattern.title]);
expect(indexList).to.eql(indexPattern.title);
});
});
});

View file

@ -289,7 +289,7 @@ export function IndexPatternProvider(Private, config, Promise, confirmModalPromi
if (!Array.isArray(detailedIndices)) {
return detailedIndices.index;
}
return _.pluck(detailedIndices, 'index');
return detailedIndices.map(({ index }) => index).join(',');
});
}