Merge pull request #9950 from seuf/es_56_max_concurrent_shards_request

Elasticsearch max_concurrent_shard_requests parameter for es 5.6+
This commit is contained in:
Carl Bergquist 2017-11-22 10:49:46 +01:00 committed by GitHub
commit d8d44224f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -8,6 +8,7 @@ export class ElasticConfigCtrl {
constructor($scope) {
this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp';
this.current.jsonData.esVersion = this.current.jsonData.esVersion || 5;
this.current.jsonData.maxConcurrentShardRequests = this.current.jsonData.maxConcurrentShardRequests || 256;
}
indexPatternTypes = [
@ -22,6 +23,7 @@ export class ElasticConfigCtrl {
esVersions = [
{name: '2.x', value: 2},
{name: '5.x', value: 5},
{name: '5.6+', value: 56},
];
indexPatternTypeChanged() {

View File

@ -16,6 +16,7 @@ export class ElasticDatasource {
timeField: string;
esVersion: number;
interval: string;
maxConcurrentShardRequests: number;
queryBuilder: ElasticQueryBuilder;
indexPattern: IndexPattern;
@ -30,6 +31,7 @@ export class ElasticDatasource {
this.esVersion = instanceSettings.jsonData.esVersion;
this.indexPattern = new IndexPattern(instanceSettings.index, instanceSettings.jsonData.interval);
this.interval = instanceSettings.jsonData.timeInterval;
this.maxConcurrentShardRequests = instanceSettings.jsonData.maxConcurrentShardRequests;
this.queryBuilder = new ElasticQueryBuilder({
timeField: this.timeField,
esVersion: this.esVersion,
@ -213,11 +215,15 @@ export class ElasticDatasource {
}
getQueryHeader(searchType, timeFrom, timeTo) {
return angular.toJson({
search_type: searchType,
"ignore_unavailable": true,
index: this.indexPattern.getIndexList(timeFrom, timeTo),
});
var query_header: any = {
search_type: searchType,
"ignore_unavailable": true,
index: this.indexPattern.getIndexList(timeFrom, timeTo),
};
if (this.esVersion >= 56) {
query_header["max_concurrent_shard_requests"] = this.maxConcurrentShardRequests;
}
return angular.toJson(query_header);
}
query(options) {

View File

@ -25,6 +25,10 @@
<span class="gf-form-label width-9">Version</span>
<select class="gf-form-input gf-size-auto" ng-model="ctrl.current.jsonData.esVersion" ng-options="f.value as f.name for f in ctrl.esVersions"></select>
</div>
<div class="gf-form max-width-30" ng-if="ctrl.current.jsonData.esVersion>=56">
<span class="gf-form-label width-15">Max concurrent Shard Requests</span>
<input class="gf-form-input" type="text" ng-model='ctrl.current.jsonData.maxConcurrentShardRequests' placeholder="" required></input>
</div>
<div class="gf-form-inline">
<div class="gf-form">
<span class="gf-form-label width-9">Min interval</span>