Skip to content

Commit bef7fb5

Browse files
committed
feat(version): remove _type
1 parent 58fac7e commit bef7fb5

6 files changed

+16
-45
lines changed

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@ const stream = streamify([1, 2, 3])
4848
.pipe(dbclient()); // put documents into elasticsearch
4949

5050
stream.on('finish', () => {
51-
// let's assume that documents with the same type but another timestamp (for example old copies)
52-
// have to be deleted
5351
const client = new elasticsearch.Client(config.esclient);
5452
elasticDeleteQuery(client);
5553

5654
const options = {
5755
index: config.schema.indexName,
58-
type: 'venue',
5956
body: {
6057
query: {
6158
"bool": {

src/BatchManager.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,18 @@ BatchManager.prototype._dispatch = function( batch, next ){
5555
this._stats.inc( 'indexed', batch._slots.length );
5656
this._stats.inc( 'batch_ok', 1 );
5757

58-
var types = {};
5958
var failures = 0;
6059

6160
batch._slots.forEach( function( task ){
6261
if( task.status < 299 ){
63-
const type = task.data.layer || task.cmd.index._type;
64-
if( !types.hasOwnProperty( type ) ){
65-
types[ type ] = 0;
66-
}
67-
types[ type ]++;
62+
this._stats.inc( task.data.layer || 'default', 1 );
6863
} else {
6964
failures++;
7065
}
7166
});
7267

7368
this._stats.inc( 'batch_retries', batch.retries );
7469
this._stats.inc( 'failed_records', failures );
75-
76-
for( var type in types ){
77-
this._stats.inc( type, types[type] );
78-
}
7970
}
8071

8172
// console.log( 'batch complete', err, batch._slots.length );

src/Task.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ function Task( record ){
55
this.cmd = {
66
index: {
77
_index: record._index,
8-
_type: record._type,
98
_id: record._id
109
}
1110
};

src/configValidation.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ const schema = Joi.object().keys({
1515
requestTimeout: Joi.number().integer().min(0)
1616
}).unknown(true),
1717
schema: Joi.object().keys({
18-
indexName: Joi.string().required(),
19-
typeName: Joi.string().required()
18+
indexName: Joi.string().required()
2019
})
2120
}).unknown(true);
2221

test/configValidation.js

+14-28
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ module.exports.tests.validate = function(test, common) {
1111
var config = {
1212
esclient: {},
1313
schema: {
14-
indexName: 'example_index',
15-
typeName: 'example_type'
14+
indexName: 'example_index'
1615
}
1716
};
1817

@@ -30,8 +29,7 @@ module.exports.tests.validate = function(test, common) {
3029
},
3130
esclient: {},
3231
schema: {
33-
indexName: 'example_index',
34-
typeName: 'example_type'
32+
indexName: 'example_index'
3533
}
3634
};
3735

@@ -51,8 +49,7 @@ module.exports.tests.validate = function(test, common) {
5149
},
5250
esclient: {},
5351
schema: {
54-
indexName: 'example_index',
55-
typeName: 'example_type'
52+
indexName: 'example_index'
5653
}
5754
};
5855

@@ -74,8 +71,7 @@ module.exports.tests.validate = function(test, common) {
7471
},
7572
esclient: {},
7673
schema: {
77-
indexName: 'example_index',
78-
typeName: 'example_type'
74+
indexName: 'example_index'
7975
}
8076
};
8177

@@ -94,8 +90,7 @@ module.exports.tests.validate = function(test, common) {
9490
},
9591
esclient: {},
9692
schema: {
97-
indexName: 'example_index',
98-
typeName: 'example_type'
93+
indexName: 'example_index'
9994
}
10095
};
10196

@@ -115,8 +110,7 @@ module.exports.tests.validate = function(test, common) {
115110
},
116111
esclient: {},
117112
schema: {
118-
indexName: 'example_index',
119-
typeName: 'example_type'
113+
indexName: 'example_index'
120114
}
121115
};
122116

@@ -138,8 +132,7 @@ module.exports.tests.validate = function(test, common) {
138132
},
139133
esclient: {},
140134
schema: {
141-
indexName: 'example_index',
142-
typeName: 'example_type'
135+
indexName: 'example_index'
143136
}
144137
};
145138

@@ -160,8 +153,7 @@ module.exports.tests.validate = function(test, common) {
160153
},
161154
esclient: value,
162155
schema: {
163-
indexName: 'example_index',
164-
typeName: 'example_type'
156+
indexName: 'example_index'
165157
}
166158
};
167159

@@ -186,8 +178,7 @@ module.exports.tests.validate = function(test, common) {
186178
requestTimeout: value
187179
},
188180
schema: {
189-
indexName: 'example_index',
190-
typeName: 'example_type'
181+
indexName: 'example_index'
191182
}
192183
};
193184

@@ -210,8 +201,7 @@ module.exports.tests.validate = function(test, common) {
210201
requestTimeout: 17.3
211202
},
212203
schema: {
213-
indexName: 'example_index',
214-
typeName: 'example_type'
204+
indexName: 'example_index'
215205
}
216206
};
217207

@@ -233,8 +223,7 @@ module.exports.tests.validate = function(test, common) {
233223
requestTimeout: -1
234224
},
235225
schema: {
236-
indexName: 'example_index',
237-
typeName: 'example_type'
226+
indexName: 'example_index'
238227
}
239228
};
240229

@@ -315,8 +304,7 @@ module.exports.tests.validate = function(test, common) {
315304
},
316305
esclient: {},
317306
schema: {
318-
indexName: 'example_index',
319-
typeName: 'example_type'
307+
indexName: 'example_index'
320308
}
321309
};
322310

@@ -344,8 +332,7 @@ module.exports.tests.validate = function(test, common) {
344332
requestTimeout: 17
345333
},
346334
schema: {
347-
indexName: 'example_index',
348-
typeName: 'example_type'
335+
indexName: 'example_index'
349336
}
350337
};
351338

@@ -374,8 +361,7 @@ module.exports.tests.validate = function(test, common) {
374361
requestTimeout: 17
375362
},
376363
schema: {
377-
indexName: 'example_index',
378-
typeName: 'example_type'
364+
indexName: 'example_index'
379365
}
380366
};
381367

test/stream.js

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ module.exports.tests.functional_example = function(test, common) {
4444
stream.pipe(assertStream);
4545
stream.write({
4646
_index: 'foo',
47-
_type: 'foo',
4847
_id: 'foo',
4948
data: {}
5049
});

0 commit comments

Comments
 (0)