From 6cfffc00218bcd85115e7d152f14d09c480ef042 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 13 Mar 2024 14:04:35 +0100 Subject: [PATCH] remove `_type` (#157) Remove references to `_type` from this repo in order to support elasticsearch v8. Prior to version 6 `_type` was recommended to be "_doc", in es7 it was optional (but if specified it was required to be "_doc"), in es8 it's not allowed at all. See: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/removal-of-types.html BREAKING CHANGE: Pelias no longer supports elasticsearch v6 This change drops support for elasticsearch v6 in order to support v8. The current recommended version remains v7. --- Document.js | 4 ---- package.json | 2 +- test/document/toESDocument.js | 6 +----- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Document.js b/Document.js index 499487b..e838830 100644 --- a/Document.js +++ b/Document.js @@ -143,10 +143,6 @@ Document.prototype.toESDocument = function() { return { _index: _.get(config, 'schema.indexName', 'pelias'), _id: this.getGid(), - // In ES7, the only allowed document type will be `_doc`. - // However underscores are not allowed until ES6, so use `doc` for now - // see https://github.com/elastic/elasticsearch/pull/27816 - _type: _.get(config, 'schema.typeName', 'doc'), data: doc }; }; diff --git a/package.json b/package.json index 6d2a702..fd9d7ad 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "lodash": "^4.6.1", - "pelias-config": "^4.5.0", + "pelias-config": "^6.0.0", "through2": "^3.0.0" }, "devDependencies": { diff --git a/test/document/toESDocument.js b/test/document/toESDocument.js index 567a410..3bf21da 100644 --- a/test/document/toESDocument.js +++ b/test/document/toESDocument.js @@ -3,8 +3,7 @@ const codec = require('../../codec'); var fakeGeneratedConfig = { schema: { - indexName: 'example_index', - typeName: 'example_type' + indexName: 'example_index' } }; @@ -50,7 +49,6 @@ module.exports.tests.toESDocument = function(test) { var expected = { _index: 'example_index', - _type: 'example_type', _id: 'mysource:mylayer:myid', data: { layer: 'mylayer', @@ -102,7 +100,6 @@ module.exports.tests.toESDocument = function(test) { var expected = { _index: 'example_index', - _type: 'example_type', _id: 'mysource:mylayer:myid', data: { source: 'mysource', @@ -156,7 +153,6 @@ module.exports.tests.toESDocument = function(test) { var expected = { _index: 'example_index', - _type: 'example_type', _id: 'mysource:mylayer:myid', data: { source: 'mysource',