Skip to content

Commit

Permalink
[Maps] Handle cross cluster index _settings resp (#66797) (#66813)
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed May 15, 2020
1 parent d9532b8 commit b80bb68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ export function getIndexPatternSettings(indicesSettingsResp) {
maxInnerResultWindow = Math.min(indexMaxInnerResultWindow, indexMaxResultWindow);
});

return { maxResultWindow, maxInnerResultWindow };
return {
maxResultWindow: maxResultWindow === Infinity ? DEFAULT_MAX_RESULT_WINDOW : maxResultWindow,
maxInnerResultWindow:
maxInnerResultWindow === Infinity ? DEFAULT_MAX_INNER_RESULT_WINDOW : maxInnerResultWindow,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ describe('max_result_window and max_inner_result_window are not set', () => {
expect(maxInnerResultWindow).toBe(DEFAULT_MAX_INNER_RESULT_WINDOW);
});

test('Should provide default values from cross cluster index response', () => {
// _settings returns empty object for cross cluster index
const indicesSettingsResp = {};
const { maxResultWindow, maxInnerResultWindow } = getIndexPatternSettings(indicesSettingsResp);
expect(maxResultWindow).toBe(DEFAULT_MAX_RESULT_WINDOW);
expect(maxInnerResultWindow).toBe(DEFAULT_MAX_INNER_RESULT_WINDOW);
});

test('Should include default values when providing minimum values for indices in index pattern', () => {
const indicesSettingsResp = {
kibana_sample_data_logs: {
Expand Down

0 comments on commit b80bb68

Please sign in to comment.