Skip to content

Commit

Permalink
Merge pull request #331 from pelias/not_analyzed-literal
Browse files Browse the repository at this point in the history
feat(mapping): use "index": "not_analyzed" for literal fields
  • Loading branch information
orangejulius authored Nov 3, 2018
2 parents 7bcd8f9 + 6978541 commit db8b237
Show file tree
Hide file tree
Showing 6 changed files with 493 additions and 262 deletions.
5 changes: 3 additions & 2 deletions mappings/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ const postalcode = require('./partial/postalcode');
const hash = require('./partial/hash');
const multiplier = require('./partial/multiplier');
const literal = require('./partial/literal');
const literal_with_doc_values = require('./partial/literal_with_doc_values');
const config = require('pelias-config').generate();

var schema = {
properties: {

// data partitioning
source: literal,
layer: literal,
source: literal_with_doc_values,
layer: literal_with_doc_values,
alpha3: admin,

// place name (ngram analysis)
Expand Down
3 changes: 2 additions & 1 deletion mappings/partial/literal.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "string",
"analyzer": "keyword"
"index": "not_analyzed",
"doc_values": false
}
4 changes: 4 additions & 0 deletions mappings/partial/literal_with_doc_values.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "string",
"index": "not_analyzed"
}
4 changes: 2 additions & 2 deletions test/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module.exports.tests.parent_analysis = function(test, common) {
t.equal(prop[field+'_a'].type, 'string');
t.equal(prop[field+'_a'].analyzer, 'peliasAdmin');
t.equal(prop[field+'_id'].type, 'string');
t.equal(prop[field+'_id'].analyzer, 'keyword');
t.equal(prop[field+'_id'].index, 'not_analyzed');

t.end();
});
Expand All @@ -129,7 +129,7 @@ module.exports.tests.parent_analysis = function(test, common) {
t.equal(prop['postalcode'+'_a'].type, 'string');
t.equal(prop['postalcode'+'_a'].analyzer, 'peliasZip');
t.equal(prop['postalcode'+'_id'].type, 'string');
t.equal(prop['postalcode'+'_id'].analyzer, 'keyword');
t.equal(prop['postalcode'+'_id'].index, 'not_analyzed');

t.end();
});
Expand Down
Loading

0 comments on commit db8b237

Please sign in to comment.