mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
set timeout for timelion search requests (#19711)
* set timeout for timelion search requests * stub out server.config for mocha testing * test timeout set * arrow functions
This commit is contained in:
parent
ec69a02d7e
commit
e38d1d92be
3 changed files with 20 additions and 1 deletions
|
@ -181,6 +181,13 @@ describe(filename, () => {
|
|||
expect(request.index).to.equal('beer');
|
||||
});
|
||||
|
||||
it('sets the timeout on the request', () => {
|
||||
config.index = 'beer';
|
||||
const request = fn(config, tlConfig, emptyScriptedFields);
|
||||
|
||||
expect(request.timeout).to.equal('30000ms');
|
||||
});
|
||||
|
||||
it('always sets body.size to 0', () => {
|
||||
const request = fn(config, tlConfig, emptyScriptedFields);
|
||||
|
||||
|
|
|
@ -40,6 +40,18 @@ export default function () {
|
|||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
config: () => {
|
||||
return {
|
||||
get: (key) => {
|
||||
switch (key) {
|
||||
case 'elasticsearch.shardTimeout':
|
||||
return 30000;
|
||||
default:
|
||||
throw new Error(`unexpected config ${key}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@ export default function buildRequest(config, tlConfig, scriptedFields) {
|
|||
|
||||
_.assign(aggCursor, createDateAgg(config, tlConfig, scriptedFields));
|
||||
|
||||
|
||||
return {
|
||||
index: config.index,
|
||||
timeout: tlConfig.server.config().get('elasticsearch.shardTimeout') + 'ms',
|
||||
body: {
|
||||
query: {
|
||||
bool: bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue