Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with elasticsearch 8 (maintains support for elasticsearch 7) #488

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
os:
- ${{ vars.UBUNTU_VERSION }}
node-version: [16.x, 18.x]
es-version: [7.6.1]
es-version: [7.6.1, 8.0.0, 8.8.0]
jdk-version: [oraclejdk11]
steps:
- uses: actions/checkout@v2
Expand Down
62 changes: 31 additions & 31 deletions integration/address_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.number': 30 } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'match street number' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'match street number' );
done();
});
});
Expand All @@ -82,9 +82,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match_phrase: { 'address_parts.street': 'west 26th street' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 2, 'match street name' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 2, 'match street name' );
done();
});
});
Expand All @@ -96,9 +96,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match_phrase: { 'address_parts.street': 'W 26th ST' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 2, 'match street name - abbr' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 2, 'match street name - abbr' );
done();
});
});
Expand All @@ -110,9 +110,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '10010' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 3, 'match zip - numeric' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 3, 'match zip - numeric' );
done();
});
});
Expand All @@ -124,9 +124,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'e24dn' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'match zip - string' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'match zip - string' );
done();
});
});
Expand All @@ -138,9 +138,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '100-10' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 3, 'match zip - numeric - punct' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 3, 'match zip - numeric - punct' );
done();
});
});
Expand All @@ -152,9 +152,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': '10 0 10' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 3, 'match zip - numeric - whitespace' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 3, 'match zip - numeric - whitespace' );
done();
});
});
Expand All @@ -166,9 +166,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'E2-4DN' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'match zip - string - punct' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'match zip - string - punct' );
done();
});
});
Expand All @@ -180,9 +180,9 @@ module.exports.tests.functional = function(test, common){
body: { query: { bool: { must: [
{ match: { 'address_parts.zip': 'E2 4DN' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'match zip - string - whitespace' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'match zip - string - whitespace' );
done();
});
});
Expand Down Expand Up @@ -289,10 +289,10 @@ module.exports.tests.venue_vs_address = function(test, common){
}
}
}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), TOTAL_ADDRESS_DOCS+1, 'matched all docs' );
t.equal( res.hits.hits[TOTAL_ADDRESS_DOCS]._id, '1', 'exact name match first' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), TOTAL_ADDRESS_DOCS+1, 'matched all docs' );
t.equal( body.hits.hits[TOTAL_ADDRESS_DOCS]._id, '1', 'exact name match first' );
done();
});
});
Expand Down
72 changes: 36 additions & 36 deletions integration/admin_abbreviations.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -77,10 +77,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -99,10 +99,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -121,10 +121,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand Down Expand Up @@ -177,10 +177,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -199,10 +199,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -221,10 +221,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand All @@ -243,10 +243,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand Down Expand Up @@ -311,10 +311,10 @@ module.exports.tests.synonyms = function (test, common) {
}
}
}
}, (err, res) => {
t.equal(err, undefined);
t.equal(getTotalHits(res.hits), 2, 'matches both documents');
t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match');
}, (err, { body }) => {
t.false(err);
t.equal(getTotalHits(body.hits), 2, 'matches both documents');
t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match');
done();
});
});
Expand Down
18 changes: 9 additions & 9 deletions integration/admin_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ module.exports.tests.functional = function(test, common){
suite.client.search({
index: suite.props.index,
body: { query: { match: { 'parent.country': 'Test Country' } } }
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'document found' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'document found' );
done();
});
});
Expand All @@ -58,9 +58,9 @@ module.exports.tests.functional = function(test, common){
suite.client.search({
index: suite.props.index,
body: { query: { match: { 'parent.country_a': 'TestCountry' } } }
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'document found' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'document found' );
done();
});
});
Expand All @@ -70,9 +70,9 @@ module.exports.tests.functional = function(test, common){
suite.client.search({
index: suite.props.index,
body: { query: { match: { 'parent.country_id': '100' } } }
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'document found' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'document found' );
done();
});
});
Expand Down
14 changes: 7 additions & 7 deletions integration/analyzer_peliasPhrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ module.exports.tests.slop_query = function(test, common){
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: config.schema.typeName,
searchType: 'dfs_query_then_fetch',
body: buildQuery('Lake Cayuga')
}, function( err, res ){
t.equal( getTotalHits(res.hits), 3 );
var hits = res.hits.hits;
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 3 );
var hits = body.hits.hits;

t.equal( hits[0]._source.name.default, 'Lake Cayuga' );

Expand Down Expand Up @@ -273,9 +273,9 @@ module.exports.tests.slop = function(test, common){
'slop': 3,
}
}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'document found' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'document found' );
done();
});
});
Expand Down
18 changes: 9 additions & 9 deletions integration/autocomplete_abbreviated_street_names.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
'query': 'Grolmanstr.'
}
}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( getTotalHits(res.hits), 1, 'document found' );
}, (err, { body }) => {
t.false(err);
t.equal( getTotalHits(body.hits), 1, 'document found' );
done();
});
});
Expand Down Expand Up @@ -78,9 +78,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
// 'query': 'Grolmanstraße'
// }
// }}}
// }, function( err, res ){
// t.equal( err, undefined );
// t.equal( getTotalHits(res.hits), 1, 'document found' );
// }, (err, { body }) => {
// t.false(err);
// t.equal( getTotalHits(body.hits), 1, 'document found' );
// done();
// });
// });
Expand All @@ -98,9 +98,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
// 'query': 'Grolmanstraße'
// }
// }}}
// }, function( err, res ){
// t.equal( err, undefined );
// t.equal( getTotalHits(res.hits), 1, 'document found' );
// }, (err, { body }) => {
// t.false(err);
// t.equal( getTotalHits(body.hits), 1, 'document found' );
// done();
// });
// });
Expand Down
Loading