3 var IS_DEVELOPMENT
= process
.env
.NODE_ENV
=== 'dev';
6 // expects an array of updates where each element is a valid req for elasticClient.update
7 createBulkUpdate: function(updates
) {
9 body
: updates
.reduce(function(body
, update
) {
15 _retry_on_conflict
: update
._retry_on_conflict
18 body
.push(update
.body
);
23 findErrors: function(req
, res
) {
25 // ERRORS for bulk updater disabled in dev until
26 // https://github.com/troupe/gitter-webapp/issues/2080
30 if (!res
.errors
) return;
34 res
.items
.forEach(function(item
, index
) {
35 if (item
.update
.error
) {
37 path
: req
.body
[index
* 2],
38 body
: req
.body
[index
* 2 + 1],
44 if (!errors
.length
) return;
47 'elastic bulk upload failed for some. failures: ' + JSON
.stringify(errors
, null, 2)