diff --git a/README.md b/README.md index 1e9ae3c4..3a5c65fb 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ node scripts/update_settings.js # update index settings #### output schema file -Use this script to pretty-print the whole schema file or a single mapping to stdout. +Use this script to pretty-print the schema's mappings to stdout. ```bash node scripts/output_mapping.js diff --git a/scripts/list_analyzers.js b/scripts/list_analyzers.js index ee386f56..f7e367c6 100644 --- a/scripts/list_analyzers.js +++ b/scripts/list_analyzers.js @@ -1,7 +1,6 @@ const _ = require('lodash') const colors = require('colors') const cli = require('./cli'); -const config = require('pelias-config').generate(); const schema = require('../schema'); const DEFAULT_ANALYZER = 'standard'; const NOT_APPLICABLE_ANALYZER = 'n/a'; @@ -54,7 +53,7 @@ const error = function(vals) { } // parse mapping -const mapping = schema.mappings[config.schema.typeName]; +const mapping = schema.mappings; const dynamic = mapping.dynamic_templates.map(t => _.first(_.map(t, v => v))); // process and single mapping property (recursively) diff --git a/scripts/output_mapping.js b/scripts/output_mapping.js index c05da280..3cc6b050 100644 --- a/scripts/output_mapping.js +++ b/scripts/output_mapping.js @@ -1,21 +1,4 @@ -var config = require('pelias-config').generate(); -var es = require('elasticsearch'); -var client = new es.Client(config.esclient); 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 - -// 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 ) ); -} +console.log( JSON.stringify( schema.mappings, null, 2 ) );