pelias-schema 6.7.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/configValidation.js +0 -1
  3. package/integration/address_matching.js +3 -19
  4. package/integration/admin_abbreviations.js +4 -19
  5. package/integration/admin_matching.js +2 -6
  6. package/integration/analyzer_peliasAdmin.js +6 -6
  7. package/integration/analyzer_peliasHousenumber.js +3 -3
  8. package/integration/analyzer_peliasIndexOneEdgeGram.js +8 -8
  9. package/integration/analyzer_peliasPhrase.js +8 -13
  10. package/integration/analyzer_peliasQuery.js +5 -5
  11. package/integration/analyzer_peliasStreet.js +8 -8
  12. package/integration/analyzer_peliasZip.js +3 -3
  13. package/integration/autocomplete_abbreviated_street_names.js +3 -8
  14. package/integration/autocomplete_directional_synonym_expansion.js +5 -15
  15. package/integration/autocomplete_street_synonym_expansion.js +5 -15
  16. package/integration/bounding_box.js +2 -4
  17. package/integration/dynamic_templates.js +4 -14
  18. package/integration/multi_token_synonyms.js +2 -3
  19. package/integration/run.js +1 -3
  20. package/integration/source_layer_sourceid_filtering.js +6 -13
  21. package/integration/validate.js +2 -2
  22. package/mappings/partial/admin.json +1 -2
  23. package/mappings/partial/countryAbbreviation.json +1 -2
  24. package/package.json +4 -4
  25. package/scripts/check_plugins.js +1 -10
  26. package/scripts/create_index.js +0 -1
  27. package/scripts/list_analyzers.js +1 -2
  28. package/scripts/output_mapping.js +1 -18
  29. package/settings.js +1 -1
  30. package/test/configValidation.js +1 -37
  31. package/test/elastictest/Suite.js +103 -0
  32. package/test/fixtures/expected.json +29 -57
  33. package/test/settings.js +1 -1
  34. package/scripts/reset_type.js +0 -26
@@ -8,8 +8,7 @@
8
8
  "type": "text",
9
9
  "analyzer": "peliasIndexOneEdgeGram",
10
10
  "search_analyzer": "peliasAdmin",
11
- "similarity": "peliasDefaultSimilarity",
12
- "doc_values": false
11
+ "similarity": "peliasDefaultSimilarity"
13
12
  }
14
13
  }
15
14
  }
@@ -8,8 +8,7 @@
8
8
  "type": "text",
9
9
  "analyzer": "peliasIndexCountryAbbreviationOneEdgeGram",
10
10
  "search_analyzer": "peliasQuery",
11
- "similarity": "peliasDefaultSimilarity",
12
- "doc_values": false
11
+ "similarity": "peliasDefaultSimilarity"
13
12
  }
14
13
  }
15
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pelias-schema",
3
- "version": "6.7.0",
3
+ "version": "7.0.0",
4
4
  "author": "pelias",
5
5
  "description": "Elasticsearch schema files and tooling for Pelias",
6
6
  "homepage": "https://github.com/pelias/schema",
@@ -11,7 +11,6 @@
11
11
  "integration": "./bin/integration",
12
12
  "create_index": "./bin/create_index",
13
13
  "drop_index": "node scripts/drop_index",
14
- "reset_type": "node scripts/reset_type",
15
14
  "update_settings": "node scripts/update_settings"
16
15
  },
17
16
  "repository": {
@@ -34,15 +33,16 @@
34
33
  "elasticsearch": "^16.0.0",
35
34
  "glob": "^7.1.6",
36
35
  "lodash": "^4.17.15",
37
- "pelias-config": "^4.5.0",
36
+ "pelias-config": "^6.0.0",
38
37
  "pelias-logger": "^1.3.0",
39
38
  "semver": "^7.1.1"
40
39
  },
41
40
  "devDependencies": {
41
+ "async": "^3.2.5",
42
42
  "difflet": "^1.0.1",
43
- "elastictest": "^3.0.0",
44
43
  "iso3166-1": "^0.5.1",
45
44
  "proxyquire": "^2.0.0",
45
+ "randomstring": "^1.3.0",
46
46
  "tap-spec": "^5.0.0",
47
47
  "tape": "^5.0.0"
48
48
  },
@@ -10,15 +10,6 @@ const required = ['analysis-icu'];
10
10
  // list of failures
11
11
  let failures = [];
12
12
 
13
- // returns the appropriate plugin name for the configured Elasticsearch version
14
- function elasticsearchPluginUtility() {
15
- if (config.esclient.apiVersion === '2.4') {
16
- return 'plugin';
17
- } else {
18
- return 'elasticsearch-plugin';
19
- }
20
- }
21
-
22
13
  cli.header("checking elasticsearch plugins");
23
14
  client.nodes.info(null, (err, res) => {
24
15
 
@@ -76,7 +67,7 @@ client.nodes.info(null, (err, res) => {
76
67
  failures.forEach(failure => {
77
68
  console.error( `\nyou can install the missing packages on '${failure.node.name}' [${failure.node.ip}] with the following command(s):\n` );
78
69
  failure.plugins.forEach(plugin => {
79
- console.error( colors.green( `sudo ${failure.node.settings.path.home}/bin/${elasticsearchPluginUtility()} install ${plugin}`) );
70
+ console.error( colors.green( `sudo ${failure.node.settings.path.home}/bin/elasticsearch-plugin install ${plugin}`) );
80
71
  });
81
72
  });
82
73
  console.error( colors.white("\nnote:") + "some plugins may require you to restart elasticsearch.\n");
@@ -30,7 +30,6 @@ const indexName = config.schema.indexName;
30
30
  const req = {
31
31
  index: indexName,
32
32
  body: schema,
33
- include_type_name: false
34
33
  };
35
34
 
36
35
  client.indices.create(req, (err, res) => {
@@ -1,7 +1,6 @@
1
1
  const _ = require('lodash')
2
2
  const colors = require('colors')
3
3
  const cli = require('./cli');
4
- const config = require('pelias-config').generate();
5
4
  const schema = require('../schema');
6
5
  const DEFAULT_ANALYZER = 'standard';
7
6
  const NOT_APPLICABLE_ANALYZER = 'n/a';
@@ -54,7 +53,7 @@ const error = function(vals) {
54
53
  }
55
54
 
56
55
  // parse mapping
57
- const mapping = schema.mappings[config.schema.typeName];
56
+ const mapping = schema.mappings;
58
57
  const dynamic = mapping.dynamic_templates.map(t => _.first(_.map(t, v => v)));
59
58
 
60
59
  // process and single mapping property (recursively)
@@ -1,21 +1,4 @@
1
- var config = require('pelias-config').generate();
2
- var es = require('elasticsearch');
3
- var client = new es.Client(config.esclient);
4
1
  var schema = require('../schema');
5
2
 
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
- }
3
+ console.log( JSON.stringify( schema.mappings, null, 2 ) );
21
4
 
package/settings.js CHANGED
@@ -226,7 +226,7 @@ function generate(){
226
226
  "only_on_same_position": "true"
227
227
  },
228
228
  "peliasOneEdgeGramFilter": {
229
- "type" : "edgeNGram",
229
+ "type" : "edge_ngram",
230
230
  "min_gram" : 1,
231
231
  "max_gram" : 24
232
232
  },
@@ -19,7 +19,7 @@ module.exports.tests.interface = function(test, common) {
19
19
 
20
20
  test('config without schema.indexName should throw error', function(t) {
21
21
  var config = {
22
- schema: { typeName: 'example_type' },
22
+ schema: {},
23
23
  esclient: {}
24
24
  };
25
25
 
@@ -30,25 +30,11 @@ module.exports.tests.interface = function(test, common) {
30
30
 
31
31
  });
32
32
 
33
- test('config without schema.typeName should throw error', function (t) {
34
- var config = {
35
- schema: { indexName: 'example_index' },
36
- esclient: {}
37
- };
38
-
39
- t.throws(function () {
40
- configValidation.validate(config);
41
- }, /"schema.typeName" is required/, 'schema.typeName should exist');
42
- t.end();
43
-
44
- });
45
-
46
33
  test('config with non-string schema.indexName should throw error', function(t) {
47
34
  [null, 17, {}, [], false].forEach((value) => {
48
35
  var config = {
49
36
  schema: {
50
37
  indexName: value,
51
- typeName: 'example_type'
52
38
  },
53
39
  esclient: {}
54
40
  };
@@ -63,32 +49,11 @@ module.exports.tests.interface = function(test, common) {
63
49
 
64
50
  });
65
51
 
66
- test('config with non-string schema.typeName should throw error', function (t) {
67
- [null, 17, {}, [], false].forEach((value) => {
68
- var config = {
69
- schema: {
70
- indexName: 'example_index',
71
- typeName: value
72
- },
73
- esclient: {}
74
- };
75
-
76
- t.throws(function () {
77
- configValidation.validate(config);
78
- }, /"schema.typeName" must be a string/, 'schema.typeName should be a string');
79
-
80
- });
81
-
82
- t.end();
83
-
84
- });
85
-
86
52
  test('config with non-object esclient should throw error', function(t) {
87
53
  [null, 17, [], 'string', true].forEach((value) => {
88
54
  var config = {
89
55
  schema: {
90
56
  indexName: 'example_index',
91
- typeName: 'example_type'
92
57
  },
93
58
  esclient: value
94
59
  };
@@ -107,7 +72,6 @@ module.exports.tests.interface = function(test, common) {
107
72
  var config = {
108
73
  schema: {
109
74
  indexName: 'example_index',
110
- typeName: 'example_type'
111
75
  },
112
76
  esclient: {}
113
77
  };
@@ -0,0 +1,103 @@
1
+ const _ = require('lodash')
2
+ const randomstring = require('randomstring')
3
+ const elasticsearch = require('elasticsearch')
4
+ const async = require('async')
5
+
6
+ function Suite (clientOpts, props) {
7
+ this.actions = []
8
+ this.asserts = []
9
+ this.client = null
10
+ this.clientOpts = !!clientOpts && (clone(clientOpts) || {
11
+ host: 'localhost:9200',
12
+ keepAlive: true
13
+ })
14
+ this.props = props || {}
15
+ if (!_.has(this, 'props.index')) {
16
+ this.props.index = 'testindex-' + randomstring.generate(7).toLowerCase()
17
+ }
18
+ }
19
+
20
+ Suite.prototype.action = function (action) {
21
+ this.actions.push(action)
22
+ }
23
+
24
+ Suite.prototype.assert = function (assert) {
25
+ this.asserts.push(assert)
26
+ }
27
+
28
+ Suite.prototype.start = function (cb) {
29
+ this.client = new elasticsearch.Client(this.clientOpts)
30
+ cb()
31
+ }
32
+
33
+ Suite.prototype.create = function (cb) {
34
+ const cmd = _.merge(this.props.create, { index: this.props.index })
35
+ if (_.has(this, 'props.schema')) {
36
+ cmd.body = this.props.schema
37
+ }
38
+ this.client.indices.create(cmd, cb)
39
+ }
40
+
41
+ Suite.prototype.delete = function (cb) {
42
+ const cmd = _.merge(this.props.delete, { index: this.props.index })
43
+ this.client.indices.delete(cmd, cb)
44
+ }
45
+
46
+ Suite.prototype.refresh = function (cb) {
47
+ const cmd = _.merge(this.props.refresh, { index: this.props.index })
48
+ this.client.indices.refresh(cmd, cb)
49
+ }
50
+
51
+ // note: optimize was replaced in version ES@2.0, forcemerge used for later versions:
52
+ // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html
53
+ Suite.prototype.optimize = function (cb) {
54
+ try {
55
+ this.client.indices.forcemerge({ index: this.props.index }, cb)
56
+ } catch (e) {
57
+ const cmd = { index: this.props.index, waitForMerge: true, force: true }
58
+ this.client.indices.optimize(cmd, cb)
59
+ }
60
+ }
61
+
62
+ Suite.prototype.waitForStatus = function (status, cb) {
63
+ const cmd = { waitForStatus: status || 'yellow' }
64
+ this.client.cluster.health(cmd, cb)
65
+ }
66
+
67
+ Suite.prototype.run = function (cb) {
68
+ const self = this
69
+ self.start(err => {
70
+ if (err) { throw new Error(err) }
71
+ self.waitForStatus('yellow', err => {
72
+ if (err) { throw new Error(err) }
73
+ self.create(err => {
74
+ if (err) { throw new Error(err) }
75
+ async.series(self.actions, err => {
76
+ if (err) { throw new Error(err) }
77
+ self.refresh(err => {
78
+ if (err) { throw new Error(err) }
79
+ self.optimize(async.series(self.asserts, err => {
80
+ if (err) { throw new Error(err) }
81
+ self.delete(err => {
82
+ if (err) { throw new Error(err) }
83
+ self.client.close()
84
+ if (_.isFunction(cb)) {
85
+ cb()
86
+ }
87
+ })
88
+ }))
89
+ })
90
+ })
91
+ })
92
+ })
93
+ })
94
+ }
95
+
96
+ // elasticsearch client requires that config objects not be reused.
97
+ // Error: Do not reuse objects to configure the elasticsearch Client class:
98
+ // https://github.com/elasticsearch/elasticsearch-js/issues/33
99
+ function clone (obj) {
100
+ return JSON.parse(JSON.stringify(obj))
101
+ }
102
+
103
+ module.exports = Suite
@@ -248,7 +248,7 @@
248
248
  "only_on_same_position": "true"
249
249
  },
250
250
  "peliasOneEdgeGramFilter": {
251
- "type": "edgeNGram",
251
+ "type": "edge_ngram",
252
252
  "min_gram": 1,
253
253
  "max_gram": 24
254
254
  },
@@ -2415,8 +2415,7 @@
2415
2415
  "type": "text",
2416
2416
  "analyzer": "peliasIndexOneEdgeGram",
2417
2417
  "search_analyzer": "peliasAdmin",
2418
- "similarity": "peliasDefaultSimilarity",
2419
- "doc_values": false
2418
+ "similarity": "peliasDefaultSimilarity"
2420
2419
  }
2421
2420
  }
2422
2421
  },
@@ -2430,8 +2429,7 @@
2430
2429
  "type": "text",
2431
2430
  "analyzer": "peliasIndexOneEdgeGram",
2432
2431
  "search_analyzer": "peliasAdmin",
2433
- "similarity": "peliasDefaultSimilarity",
2434
- "doc_values": false
2432
+ "similarity": "peliasDefaultSimilarity"
2435
2433
  }
2436
2434
  }
2437
2435
  },
@@ -2453,8 +2451,7 @@
2453
2451
  "type": "text",
2454
2452
  "analyzer": "peliasIndexOneEdgeGram",
2455
2453
  "search_analyzer": "peliasAdmin",
2456
- "similarity": "peliasDefaultSimilarity",
2457
- "doc_values": false
2454
+ "similarity": "peliasDefaultSimilarity"
2458
2455
  }
2459
2456
  }
2460
2457
  },
@@ -2468,8 +2465,7 @@
2468
2465
  "type": "text",
2469
2466
  "analyzer": "peliasIndexOneEdgeGram",
2470
2467
  "search_analyzer": "peliasAdmin",
2471
- "similarity": "peliasDefaultSimilarity",
2472
- "doc_values": false
2468
+ "similarity": "peliasDefaultSimilarity"
2473
2469
  }
2474
2470
  }
2475
2471
  },
@@ -2491,8 +2487,7 @@
2491
2487
  "type": "text",
2492
2488
  "analyzer": "peliasIndexOneEdgeGram",
2493
2489
  "search_analyzer": "peliasAdmin",
2494
- "similarity": "peliasDefaultSimilarity",
2495
- "doc_values": false
2490
+ "similarity": "peliasDefaultSimilarity"
2496
2491
  }
2497
2492
  }
2498
2493
  },
@@ -2506,8 +2501,7 @@
2506
2501
  "type": "text",
2507
2502
  "analyzer": "peliasIndexOneEdgeGram",
2508
2503
  "search_analyzer": "peliasAdmin",
2509
- "similarity": "peliasDefaultSimilarity",
2510
- "doc_values": false
2504
+ "similarity": "peliasDefaultSimilarity"
2511
2505
  }
2512
2506
  }
2513
2507
  },
@@ -2529,8 +2523,7 @@
2529
2523
  "type": "text",
2530
2524
  "analyzer": "peliasIndexOneEdgeGram",
2531
2525
  "search_analyzer": "peliasAdmin",
2532
- "similarity": "peliasDefaultSimilarity",
2533
- "doc_values": false
2526
+ "similarity": "peliasDefaultSimilarity"
2534
2527
  }
2535
2528
  }
2536
2529
  },
@@ -2544,8 +2537,7 @@
2544
2537
  "type": "text",
2545
2538
  "analyzer": "peliasIndexCountryAbbreviationOneEdgeGram",
2546
2539
  "search_analyzer": "peliasQuery",
2547
- "similarity": "peliasDefaultSimilarity",
2548
- "doc_values": false
2540
+ "similarity": "peliasDefaultSimilarity"
2549
2541
  }
2550
2542
  }
2551
2543
  },
@@ -2567,8 +2559,7 @@
2567
2559
  "type": "text",
2568
2560
  "analyzer": "peliasIndexOneEdgeGram",
2569
2561
  "search_analyzer": "peliasAdmin",
2570
- "similarity": "peliasDefaultSimilarity",
2571
- "doc_values": false
2562
+ "similarity": "peliasDefaultSimilarity"
2572
2563
  }
2573
2564
  }
2574
2565
  },
@@ -2582,8 +2573,7 @@
2582
2573
  "type": "text",
2583
2574
  "analyzer": "peliasIndexOneEdgeGram",
2584
2575
  "search_analyzer": "peliasAdmin",
2585
- "similarity": "peliasDefaultSimilarity",
2586
- "doc_values": false
2576
+ "similarity": "peliasDefaultSimilarity"
2587
2577
  }
2588
2578
  }
2589
2579
  },
@@ -2605,8 +2595,7 @@
2605
2595
  "type": "text",
2606
2596
  "analyzer": "peliasIndexOneEdgeGram",
2607
2597
  "search_analyzer": "peliasAdmin",
2608
- "similarity": "peliasDefaultSimilarity",
2609
- "doc_values": false
2598
+ "similarity": "peliasDefaultSimilarity"
2610
2599
  }
2611
2600
  }
2612
2601
  },
@@ -2620,8 +2609,7 @@
2620
2609
  "type": "text",
2621
2610
  "analyzer": "peliasIndexOneEdgeGram",
2622
2611
  "search_analyzer": "peliasAdmin",
2623
- "similarity": "peliasDefaultSimilarity",
2624
- "doc_values": false
2612
+ "similarity": "peliasDefaultSimilarity"
2625
2613
  }
2626
2614
  }
2627
2615
  },
@@ -2643,8 +2631,7 @@
2643
2631
  "type": "text",
2644
2632
  "analyzer": "peliasIndexOneEdgeGram",
2645
2633
  "search_analyzer": "peliasAdmin",
2646
- "similarity": "peliasDefaultSimilarity",
2647
- "doc_values": false
2634
+ "similarity": "peliasDefaultSimilarity"
2648
2635
  }
2649
2636
  }
2650
2637
  },
@@ -2658,8 +2645,7 @@
2658
2645
  "type": "text",
2659
2646
  "analyzer": "peliasIndexOneEdgeGram",
2660
2647
  "search_analyzer": "peliasAdmin",
2661
- "similarity": "peliasDefaultSimilarity",
2662
- "doc_values": false
2648
+ "similarity": "peliasDefaultSimilarity"
2663
2649
  }
2664
2650
  }
2665
2651
  },
@@ -2681,8 +2667,7 @@
2681
2667
  "type": "text",
2682
2668
  "analyzer": "peliasIndexOneEdgeGram",
2683
2669
  "search_analyzer": "peliasAdmin",
2684
- "similarity": "peliasDefaultSimilarity",
2685
- "doc_values": false
2670
+ "similarity": "peliasDefaultSimilarity"
2686
2671
  }
2687
2672
  }
2688
2673
  },
@@ -2696,8 +2681,7 @@
2696
2681
  "type": "text",
2697
2682
  "analyzer": "peliasIndexOneEdgeGram",
2698
2683
  "search_analyzer": "peliasAdmin",
2699
- "similarity": "peliasDefaultSimilarity",
2700
- "doc_values": false
2684
+ "similarity": "peliasDefaultSimilarity"
2701
2685
  }
2702
2686
  }
2703
2687
  },
@@ -2719,8 +2703,7 @@
2719
2703
  "type": "text",
2720
2704
  "analyzer": "peliasIndexOneEdgeGram",
2721
2705
  "search_analyzer": "peliasAdmin",
2722
- "similarity": "peliasDefaultSimilarity",
2723
- "doc_values": false
2706
+ "similarity": "peliasDefaultSimilarity"
2724
2707
  }
2725
2708
  }
2726
2709
  },
@@ -2734,8 +2717,7 @@
2734
2717
  "type": "text",
2735
2718
  "analyzer": "peliasIndexOneEdgeGram",
2736
2719
  "search_analyzer": "peliasAdmin",
2737
- "similarity": "peliasDefaultSimilarity",
2738
- "doc_values": false
2720
+ "similarity": "peliasDefaultSimilarity"
2739
2721
  }
2740
2722
  }
2741
2723
  },
@@ -2757,8 +2739,7 @@
2757
2739
  "type": "text",
2758
2740
  "analyzer": "peliasIndexOneEdgeGram",
2759
2741
  "search_analyzer": "peliasAdmin",
2760
- "similarity": "peliasDefaultSimilarity",
2761
- "doc_values": false
2742
+ "similarity": "peliasDefaultSimilarity"
2762
2743
  }
2763
2744
  }
2764
2745
  },
@@ -2772,8 +2753,7 @@
2772
2753
  "type": "text",
2773
2754
  "analyzer": "peliasIndexOneEdgeGram",
2774
2755
  "search_analyzer": "peliasAdmin",
2775
- "similarity": "peliasDefaultSimilarity",
2776
- "doc_values": false
2756
+ "similarity": "peliasDefaultSimilarity"
2777
2757
  }
2778
2758
  }
2779
2759
  },
@@ -2795,8 +2775,7 @@
2795
2775
  "type": "text",
2796
2776
  "analyzer": "peliasIndexOneEdgeGram",
2797
2777
  "search_analyzer": "peliasAdmin",
2798
- "similarity": "peliasDefaultSimilarity",
2799
- "doc_values": false
2778
+ "similarity": "peliasDefaultSimilarity"
2800
2779
  }
2801
2780
  }
2802
2781
  },
@@ -2810,8 +2789,7 @@
2810
2789
  "type": "text",
2811
2790
  "analyzer": "peliasIndexOneEdgeGram",
2812
2791
  "search_analyzer": "peliasAdmin",
2813
- "similarity": "peliasDefaultSimilarity",
2814
- "doc_values": false
2792
+ "similarity": "peliasDefaultSimilarity"
2815
2793
  }
2816
2794
  }
2817
2795
  },
@@ -2833,8 +2811,7 @@
2833
2811
  "type": "text",
2834
2812
  "analyzer": "peliasIndexOneEdgeGram",
2835
2813
  "search_analyzer": "peliasAdmin",
2836
- "similarity": "peliasDefaultSimilarity",
2837
- "doc_values": false
2814
+ "similarity": "peliasDefaultSimilarity"
2838
2815
  }
2839
2816
  }
2840
2817
  },
@@ -2848,8 +2825,7 @@
2848
2825
  "type": "text",
2849
2826
  "analyzer": "peliasIndexOneEdgeGram",
2850
2827
  "search_analyzer": "peliasAdmin",
2851
- "similarity": "peliasDefaultSimilarity",
2852
- "doc_values": false
2828
+ "similarity": "peliasDefaultSimilarity"
2853
2829
  }
2854
2830
  }
2855
2831
  },
@@ -2871,8 +2847,7 @@
2871
2847
  "type": "text",
2872
2848
  "analyzer": "peliasIndexOneEdgeGram",
2873
2849
  "search_analyzer": "peliasAdmin",
2874
- "similarity": "peliasDefaultSimilarity",
2875
- "doc_values": false
2850
+ "similarity": "peliasDefaultSimilarity"
2876
2851
  }
2877
2852
  }
2878
2853
  },
@@ -2886,8 +2861,7 @@
2886
2861
  "type": "text",
2887
2862
  "analyzer": "peliasIndexOneEdgeGram",
2888
2863
  "search_analyzer": "peliasAdmin",
2889
- "similarity": "peliasDefaultSimilarity",
2890
- "doc_values": false
2864
+ "similarity": "peliasDefaultSimilarity"
2891
2865
  }
2892
2866
  }
2893
2867
  },
@@ -2909,8 +2883,7 @@
2909
2883
  "type": "text",
2910
2884
  "analyzer": "peliasIndexOneEdgeGram",
2911
2885
  "search_analyzer": "peliasAdmin",
2912
- "similarity": "peliasDefaultSimilarity",
2913
- "doc_values": false
2886
+ "similarity": "peliasDefaultSimilarity"
2914
2887
  }
2915
2888
  }
2916
2889
  },
@@ -2924,8 +2897,7 @@
2924
2897
  "type": "text",
2925
2898
  "analyzer": "peliasIndexOneEdgeGram",
2926
2899
  "search_analyzer": "peliasAdmin",
2927
- "similarity": "peliasDefaultSimilarity",
2928
- "doc_values": false
2900
+ "similarity": "peliasDefaultSimilarity"
2929
2901
  }
2930
2902
  }
2931
2903
  },
package/test/settings.js CHANGED
@@ -490,7 +490,7 @@ module.exports.tests.peliasOneEdgeGramFilter = function(test, common) {
490
490
  var s = settings();
491
491
  t.equal(typeof s.analysis.filter.peliasOneEdgeGramFilter, 'object', 'there is a peliasIndexOneEdgeGram filter');
492
492
  var filter = s.analysis.filter.peliasOneEdgeGramFilter;
493
- t.equal(filter.type, 'edgeNGram');
493
+ t.equal(filter.type, 'edge_ngram');
494
494
  t.equal(filter.min_gram, 1);
495
495
  t.equal(filter.max_gram, 24);
496
496
  t.end();
@@ -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
- });