Set timeout and terminate_after parameters when fetching terms for Input Controls (#14977) (#15040)

* set parameters like suggestions api

* provide timeout and terminate_after in initial state instead of using search_source set

* remove shard_size param and add comment about needed to replace searchsource with suggestions API
This commit is contained in:
Nathan Reese 2017-11-17 17:08:51 -07:00 committed by GitHub
parent 3783e41664
commit 9a7e9f1a51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -7,9 +7,9 @@ const termsAgg = (field, size, direction) => {
size = 1;
}
const terms = {
'size': size,
'order': {
'_count': direction
size: size,
order: {
_count: direction
}
};
if (field.scripted) {
@ -44,7 +44,11 @@ class ListControl extends Control {
export async function listControlFactory(controlParams, kbnApi) {
const indexPattern = await kbnApi.indexPatterns.get(controlParams.indexPattern);
const searchSource = new kbnApi.SearchSource();
// TODO replace SearchSource with call to suggestions API
const searchSource = new kbnApi.SearchSource({
timeout: '1s',
terminate_after: 100000
});
searchSource.inherits(false); //Do not filter by time so can not inherit from rootSearchSource
searchSource.size(0);
searchSource.index(indexPattern);

View file

@ -98,7 +98,7 @@ export function SearchSourceProvider(Promise, Private, config) {
'size',
'source',
'version',
'fields',
'fields'
];
SearchSource.prototype.index = function (indexPattern) {