pelias-schema 6.8.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,26 +0,0 @@
1
- var config = require('pelias-config').generate().esclient;
2
- var es = require('elasticsearch');
3
- var client = new es.Client(config);
4
- var schema = require('../schema');
5
-
6
- var _index = ( process.argv.length > 3 ) ? process.argv[3] : config.schema.indexName;
7
- var _type = ( process.argv.length > 2 ) ? process.argv[2] : null; // get type from cli args
8
-
9
- if( !_type ){
10
- console.error( 'you must provide the target es \'type\' as the first cli argument' );
11
- process.exit(1);
12
- }
13
-
14
- var mapping = schema.mappings[_type];
15
- if( !mapping ){
16
- console.error( 'could not find a mapping in the schema file for', _index+'/'+_type );
17
- process.exit(1);
18
- }
19
-
20
- client.indices.deleteMapping( { index: _index, type: _type }, function( err, res ){
21
- console.log( '[delete mapping]', '\t', _index+'/'+_type, err || '\t', res );
22
- client.indices.putMapping( { index: _index, type: _type, body:mapping }, function( err, res ){
23
- console.log( '[put mapping]', '\t\t', _index+'/'+_type, err || '\t', res );
24
- process.exit( !!err );
25
- });
26
- });