-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add global search timeout setting #12211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import org.elasticsearch.common.lucene.search.Queries; | ||
| import org.elasticsearch.common.lucene.search.function.BoostScoreFunction; | ||
| import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; | ||
| import org.elasticsearch.common.unit.TimeValue; | ||
| import org.elasticsearch.common.util.BigArrays; | ||
| import org.elasticsearch.index.IndexService; | ||
| import org.elasticsearch.index.analysis.AnalysisService; | ||
|
|
@@ -90,7 +91,7 @@ public class DefaultSearchContext extends SearchContext { | |
| private ScanContext scanContext; | ||
| private float queryBoost = 1.0f; | ||
| // timeout in millis | ||
| private long timeoutInMillis = -1; | ||
| private long timeoutInMillis; | ||
| // terminate after count | ||
| private int terminateAfter = DEFAULT_TERMINATE_AFTER; | ||
| private List<String> groupStats; | ||
|
|
@@ -127,7 +128,9 @@ public class DefaultSearchContext extends SearchContext { | |
| public DefaultSearchContext(long id, ShardSearchRequest request, SearchShardTarget shardTarget, | ||
| Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard, | ||
| ScriptService scriptService, PageCacheRecycler pageCacheRecycler, | ||
| BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher) { | ||
| BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher, | ||
| TimeValue timeout | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you call it something like "defaultTimeout" instead? I was a bit confused this number might come from a user while it's only a default that we fetch from the settings.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that the name
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK fair enough. |
||
| ) { | ||
| super(parseFieldMatcher); | ||
| this.id = id; | ||
| this.request = request; | ||
|
|
@@ -145,6 +148,7 @@ public DefaultSearchContext(long id, ShardSearchRequest request, SearchShardTarg | |
| this.indexService = indexService; | ||
| this.searcher = new ContextIndexSearcher(this, engineSearcher); | ||
| this.timeEstimateCounter = timeEstimateCounter; | ||
| this.timeoutInMillis = timeout.millis(); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nevermind :)