Skip to content

Commit aec1e93

Browse files
committed
v0.0.14
1 parent c4e6452 commit aec1e93

File tree

4 files changed

+39
-42
lines changed

4 files changed

+39
-42
lines changed

.travis.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,5 @@ services:
88
language: node_js
99

1010
node_js:
11-
- "0.10"
12-
- "0.12"
13-
- "iojs"
1411
- "4.0"
15-
- "5.0"
12+
- "6.0"

lib/connections/elasticsearch.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ connection.prototype.insertData = function(index, data, callback){
4242
body: { doc: d }
4343
}, function(error){
4444
if(error){
45-
if(error.message.match(/DocumentMissingException/)){
45+
if(error.message.match(/DocumentMissingException/) || error.message.match(/document_missing_exception/)){
4646
writeMethod = 'create';
4747

4848
self.connection[writeMethod]({
@@ -69,7 +69,7 @@ connection.prototype.getAll = function(index, query, fields, chunkSize, dataCall
6969
var self = this;
7070
var scrollTime = '5m';
7171
if(!rowsFound){ rowsFound = 0; }
72-
72+
7373
var payload = {
7474
index: index,
7575
scroll: scrollTime,
@@ -84,15 +84,15 @@ connection.prototype.getAll = function(index, query, fields, chunkSize, dataCall
8484
self.book.logger.log(' ' + self.name + '/' + self.type + ' >> ' + JSON.stringify(payload), 'debug');
8585

8686
self.connection.search(payload, function getMoreUntilDone(error, response){
87-
if(error){
87+
if(error){
8888
return doneCallback(error, rowsFound);
8989
}else if(response.hits.hits.length === 0){
9090
doneCallback(null, rowsFound);
9191
}else{
9292
rowsFound += response.hits.hits.length;
9393

9494
var simpleData = [];
95-
response.hits.hits.forEach(function(hit){
95+
response.hits.hits.forEach(function(hit){
9696
var row = {};
9797

9898
if(hit.fields){
@@ -113,7 +113,7 @@ connection.prototype.getAll = function(index, query, fields, chunkSize, dataCall
113113
}
114114
}
115115

116-
simpleData.push( row );
116+
simpleData.push( row );
117117
});
118118

119119
dataCallback(null, simpleData, function(){
@@ -130,4 +130,4 @@ connection.prototype.getAll = function(index, query, fields, chunkSize, dataCall
130130
});
131131
};
132132

133-
exports.connection = connection;
133+
exports.connection = connection;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "empujar",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "When you need to push data around, you push it. Push it real good. An ETL and Operations tool.",
55
"main": "index.js",
66
"engines": {

test/connections/elasticsearch.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ describe('connection: elasticsearch', function(){
4949
beforeEach(function(done){
5050
helper.indices.delete({index: index}, function(error){
5151
setTimeout(function(){
52-
if(!error || error.message.match(/IndexMissingException/)){
52+
if(!error || error.message.match(/IndexMissingException/) || error.message.match(/index_not_found/) ){
5353
done();
54-
}else{
54+
}else{
5555
done(error);
5656
}
5757
}, sleep);
@@ -63,12 +63,12 @@ describe('connection: elasticsearch', function(){
6363
// null, int, float, boolean, small-text, large-text, date, primary key
6464
var data = [
6565
{
66-
id: 1,
67-
counter: 4,
68-
happy: true,
69-
money: 100.012,
70-
when: new Date(1448486552507),
71-
small_words: 'a small amount of words',
66+
id: 1,
67+
counter: 4,
68+
happy: true,
69+
money: 100.012,
70+
when: new Date(1448486552507),
71+
small_words: 'a small amount of words',
7272
}
7373
];
7474

@@ -99,12 +99,12 @@ describe('connection: elasticsearch', function(){
9999
// null, int, float, boolean, small-text, large-text, date, primary key
100100
var data = [
101101
{
102-
id: 1,
103-
counter: 4,
104-
happy: true,
105-
money: 100.012,
106-
when: new Date(1448486552507),
107-
small_words: 'a small amount of words',
102+
id: 1,
103+
counter: 4,
104+
happy: true,
105+
money: 100.012,
106+
when: new Date(1448486552507),
107+
small_words: 'a small amount of words',
108108
}
109109
];
110110

@@ -114,8 +114,8 @@ describe('connection: elasticsearch', function(){
114114

115115
data = [
116116
{
117-
id: 1,
118-
happy: false,
117+
id: 1,
118+
happy: false,
119119
}
120120
];
121121

@@ -151,25 +151,25 @@ describe('connection: elasticsearch', function(){
151151
helper.indices.delete({index: index}, function(error){
152152
setTimeout(function(){
153153
if(!error || error.message.match(/IndexMissingException/)){
154-
154+
155155
var data = [
156156
{
157-
id: 1,
158-
email: '[email protected]',
159-
first_name: 'evan',
160-
when: new Date(1448486552507),
157+
id: 1,
158+
159+
first_name: 'evan',
160+
when: new Date(1448486552507),
161161
},
162162
{
163-
id: 2,
164-
email: '[email protected]',
165-
first_name: 'aaron',
166-
when: new Date(),
163+
id: 2,
164+
165+
first_name: 'aaron',
166+
when: new Date(),
167167
},
168168
{
169-
id: 3,
170-
email: '[email protected]',
171-
first_name: 'pablo',
172-
when: new Date(),
169+
id: 3,
170+
171+
first_name: 'pablo',
172+
when: new Date(),
173173
}
174174
];
175175

@@ -179,7 +179,7 @@ describe('connection: elasticsearch', function(){
179179
}, sleep);
180180
});
181181

182-
}else{
182+
}else{
183183
done(error);
184184
}
185185
}, sleep);
@@ -284,4 +284,4 @@ describe('connection: elasticsearch', function(){
284284

285285
});
286286

287-
});
287+
});

0 commit comments

Comments
 (0)