mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[es] append an _=Date.now() timestamp to all es GET requests
This commit is contained in:
parent
b91d6b8489
commit
69960a54cc
2 changed files with 27 additions and 3 deletions
|
@ -31,7 +31,7 @@
|
|||
"bluebird": "~2.1.3",
|
||||
"bootstrap": "~3.3.1",
|
||||
"d3": "~3.4.8",
|
||||
"elasticsearch": "~3.1.1",
|
||||
"elasticsearch": "~4.1.0",
|
||||
"Faker": "~1.1.0",
|
||||
"FileSaver": "*",
|
||||
"font-awesome": "~4.2.0",
|
||||
|
@ -55,6 +55,7 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"resolutions": {
|
||||
"angular-bootstrap": "~0.12"
|
||||
"angular-bootstrap": "~0.12",
|
||||
"elasticsearch": "~4.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
define(function (require) {
|
||||
require('elasticsearch');
|
||||
var _ = require('lodash');
|
||||
|
||||
var es; // share the client amoungst all apps
|
||||
require('modules')
|
||||
|
@ -10,7 +11,29 @@ define(function (require) {
|
|||
es = esFactory({
|
||||
host: configFile.elasticsearch,
|
||||
log: 'info',
|
||||
requestTimeout: 0
|
||||
requestTimeout: 0,
|
||||
plugins: [function (Client, config) {
|
||||
|
||||
// esFactory automatically injects the AngularConnector to the config
|
||||
// https://github.com/elastic/elasticsearch-js/blob/master/src/lib/connectors/angular.js
|
||||
_(CustomAngularConnector).inherits(config.connectionClass);
|
||||
function CustomAngularConnector(host, config) {
|
||||
CustomAngularConnector.Super.call(this, host, config);
|
||||
|
||||
var originalRequest = this.request;
|
||||
this.request = function (params) {
|
||||
if (String(params.method).toUpperCase() === 'GET') {
|
||||
params.query = params.query || {};
|
||||
params.query._ = Date.now();
|
||||
}
|
||||
|
||||
return originalRequest.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
config.connectionClass = CustomAngularConnector;
|
||||
|
||||
}]
|
||||
});
|
||||
|
||||
return es;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue