Skip to content

Commit 8ac201c

Browse files
committed
Fix "list_analyzers" and "output_mapping"
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`
1 parent 6c7abae commit 8ac201c

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ node scripts/update_settings.js # update index settings
6464

6565
#### output schema file
6666

67-
Use this script to pretty-print the whole schema file or a single mapping to stdout.
67+
Use this script to pretty-print the whole schema's mappings to stdout.
6868

6969
```bash
7070
node scripts/output_mapping.js

scripts/list_analyzers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const error = function(vals) {
5454
}
5555

5656
// parse mapping
57-
const mapping = schema.mappings[config.schema.typeName];
57+
const mapping = schema.mappings;
5858
const dynamic = mapping.dynamic_templates.map(t => _.first(_.map(t, v => v)));
5959

6060
// process and single mapping property (recursively)

scripts/output_mapping.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,5 @@ var es = require('@elastic/elasticsearch');
33
var client = new es.Client(config.esclient);
44
var schema = require('../schema');
55

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-
// print out mapping for just one type
10-
if ( _type ) {
11-
var mapping = schema.mappings[_type];
12-
if( !mapping ){
13-
console.error( 'could not find a mapping in the schema file for', _index+'/'+_type );
14-
process.exit(1);
15-
}
16-
console.log( JSON.stringify( mapping, null, 2 ) );
17-
//print out the entire schema mapping
18-
} else {
19-
console.log( JSON.stringify( schema, null, 2 ) );
20-
}
6+
console.log( JSON.stringify( schema.mappings, null, 2 ) );
217

0 commit comments

Comments
 (0)