Skip to content

Commit

Permalink
feat: support for elasticsearch v8 (#490)
Browse files Browse the repository at this point in the history
See #490 for more details.

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.
  • Loading branch information
michaelkirk committed Mar 12, 2024
1 parent e320248 commit 9fb43bc
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 253 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 schema's mappings to stdout.

```bash
node scripts/output_mapping.js
Expand Down
1 change: 0 additions & 1 deletion configValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Joi = require('@hapi/joi');
const schema = Joi.object().required().keys({
schema: Joi.object().required().keys({
indexName: Joi.string().required(),
typeName: Joi.string().required()
}),
esclient: Joi.object().required()
}).unknown(true);
Expand Down
16 changes: 0 additions & 16 deletions integration/address_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module.exports.tests.functional = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1', body: { address_parts: {
name: 'Mapzen HQ',
number: 30,
Expand All @@ -29,7 +28,6 @@ module.exports.tests.functional = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '2', body: { address_parts: {
name: 'Fake Venue',
number: 300,
Expand All @@ -42,7 +40,6 @@ module.exports.tests.functional = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '3', body: { address_parts: {
name: 'Mock British Address',
number: 3000,
Expand All @@ -55,7 +52,6 @@ module.exports.tests.functional = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '4', body: { address_parts: {
name: 'Mystery Location',
number: 300,
Expand All @@ -69,7 +65,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.number': 30 } }
]}}}
Expand All @@ -84,7 +79,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match_phrase: { 'address_parts.street': 'west 26th street' } }
]}}}
Expand All @@ -99,7 +93,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match_phrase: { 'address_parts.street': 'W 26th ST' } }
]}}}
Expand All @@ -114,7 +107,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '10010' } }
]}}}
Expand All @@ -129,7 +121,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'e24dn' } }
]}}}
Expand All @@ -144,7 +135,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '100-10' } }
]}}}
Expand All @@ -159,7 +149,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '10 0 10' } }
]}}}
Expand All @@ -174,7 +163,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'E2-4DN' } }
]}}}
Expand All @@ -189,7 +177,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'E2 4DN' } }
]}}}
Expand Down Expand Up @@ -224,7 +211,6 @@ module.exports.tests.venue_vs_address = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1', body: {
name: { default: 'Union Square' },
phrase: { default: 'Union Square' }
Expand All @@ -239,7 +225,6 @@ module.exports.tests.venue_vs_address = function(test, common){
let id = i + 100; // id offset
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: String(id),
body: {
name: { default: `${id} Union Square` },
Expand All @@ -263,7 +248,6 @@ module.exports.tests.venue_vs_address = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
size: TOTAL_ADDRESS_DOCS+1,
body: {
Expand Down
15 changes: 0 additions & 15 deletions integration/admin_abbreviations.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: {
parent: {
Expand All @@ -33,7 +32,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '2',
body: {
parent: {
Expand All @@ -47,7 +45,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -70,7 +67,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -93,7 +89,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -116,7 +111,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand Down Expand Up @@ -147,7 +141,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: {
parent: {
Expand All @@ -161,7 +154,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '2',
body: {
parent: {
Expand All @@ -175,7 +167,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -198,7 +189,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -221,7 +211,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand All @@ -244,7 +233,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand Down Expand Up @@ -275,7 +263,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: {
parent: {
Expand All @@ -289,7 +276,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.action(done => {
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '2',
body: {
parent: {
Expand All @@ -303,7 +289,6 @@ module.exports.tests.synonyms = function (test, common) {
suite.assert(done => {
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: {
query: {
Expand Down
4 changes: 0 additions & 4 deletions integration/admin_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module.exports.tests.functional = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1', body: {
parent: {
country: 'Test Country',
Expand Down Expand Up @@ -46,7 +45,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { match: { 'parent.country': 'Test Country' } } }
}, function( err, res ){
t.equal( err, undefined );
Expand All @@ -59,7 +57,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { match: { 'parent.country_a': 'TestCountry' } } }
}, function( err, res ){
t.equal( err, undefined );
Expand All @@ -72,7 +69,6 @@ module.exports.tests.functional = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { match: { 'parent.country_id': '100' } } }
}, function( err, res ){
t.equal( err, undefined );
Expand Down
5 changes: 0 additions & 5 deletions integration/analyzer_peliasPhrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ module.exports.tests.slop_query = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: { name: { default: 'Lake Cayuga' }, phrase: { default: 'Lake Cayuga' } }
}, done );
Expand All @@ -171,7 +170,6 @@ module.exports.tests.slop_query = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '2',
body: { name: { default: 'Cayuga Lake' }, phrase: { default: 'Cayuga Lake' } }
}, done );
Expand All @@ -181,7 +179,6 @@ module.exports.tests.slop_query = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '3',
body: { name: { default: '7991 Lake Cayuga Dr' }, phrase: { default: '7991 Lake Cayuga Dr' } }
}, done );
Expand Down Expand Up @@ -256,7 +253,6 @@ module.exports.tests.slop = function(test, common){
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: { name: { default: '52 Görlitzer Straße' } }
}, done);
Expand All @@ -269,7 +265,6 @@ module.exports.tests.slop = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: { query: { match_phrase: {
'name.default': {
Expand Down
5 changes: 0 additions & 5 deletions integration/autocomplete_abbreviated_street_names.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
suite.action( function( done ){
suite.client.index({
index: suite.props.index,
type: config.schema.typeName,
id: '1',
body: { name: { default: 'Grolmanstraße' } }
}, done);
Expand All @@ -31,7 +30,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
body: { query: { match: {
'name.default': {
'analyzer': 'peliasQuery',
Expand Down Expand Up @@ -62,7 +60,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
// suite.action( function( done ){
// suite.client.index({
// index: suite.props.index,
// type: config.schema.typeName,
// id: '1',
// body: { name: { default: 'Grolmanstr.' } }
// }, done);
Expand All @@ -75,7 +72,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
// suite.assert( function( done ){
// suite.client.search({
// index: suite.props.index,
// type: config.schema.typeName,
// body: { query: { match: {
// 'name.default': {
// 'analyzer': 'peliasQueryPartialToken',
Expand All @@ -96,7 +92,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
// suite.assert( function( done ){
// suite.client.search({
// index: suite.props.index,
// type: config.schema.typeName,
// body: { query: { match: {
// 'name.default': {
// 'analyzer': 'peliasQuery',
Expand Down
Loading

0 comments on commit 9fb43bc

Please sign in to comment.