diff --git a/scripts/output_mapping.js b/scripts/output_mapping.js index c96e7dd2..c05da280 100644 --- a/scripts/output_mapping.js +++ b/scripts/output_mapping.js @@ -6,15 +6,16 @@ var schema = require('../schema'); var _index = ( process.argv.length > 3 ) ? process.argv[3] : config.schema.indexName; var _type = ( process.argv.length > 2 ) ? process.argv[2] : null; // get type from cli args -if( !_type ){ +// print out mapping for just one type +if ( _type ) { + var mapping = schema.mappings[_type]; + if( !mapping ){ + console.error( 'could not find a mapping in the schema file for', _index+'/'+_type ); + process.exit(1); + } + console.log( JSON.stringify( mapping, null, 2 ) ); +//print out the entire schema mapping +} else { console.log( JSON.stringify( schema, null, 2 ) ); - process.exit(0); } -var mapping = schema.mappings[_type]; -if( !mapping ){ - console.error( 'could not find a mapping in the schema file for', _index+'/'+_type ); - process.exit(1); -} - -console.log( JSON.stringify( mapping, null, 2 ) );