Skip to content

Commit

Permalink
Fix "list_analyzers" and "output_mapping"
Browse files Browse the repository at this point in the history
I think they've been broken since
b6e92d4, which changed schema to have
a single mapping. Presumably this was done as part of deprecating `doc._type`
  • Loading branch information
michaelkirk committed Jun 15, 2023
1 parent 6c7abae commit 8ac201c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 whole schema's mappings to stdout.

```bash
node scripts/output_mapping.js
Expand Down
2 changes: 1 addition & 1 deletion scripts/list_analyzers.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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)
Expand Down
16 changes: 1 addition & 15 deletions scripts/output_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,5 @@ var es = require('@elastic/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 ) );

0 comments on commit 8ac201c

Please sign in to comment.