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

Support testing against ES5 #328

Merged
merged 1 commit into from
Oct 23, 2018
Merged
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
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ node_js:
- 10
matrix:
fast_finish: true
allow_failures:
- env: ES_VERSION=5.6.12
env:
matrix:
- ES_VERSION=2.4.6
- ES_VERSION=5.6.12
jdk:
- oraclejdk8
install:
- mkdir /tmp/elasticsearch
- wget -O - https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.tar.gz | tar xz --directory=/tmp/elasticsearch --strip-components=1
- /tmp/elasticsearch/bin/plugin install analysis-icu
- /tmp/elasticsearch/bin/elasticsearch --daemonize --path.data /tmp
- ./scripts/setup_ci.sh
- npm i
script:
- npm run travis
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ $ npm run integration
Download the image and start an elasticsearch docker container:

```bash
$ docker run --rm --name elastic-test -p 9200:9200 pelias/elasticsearch
$ docker run --rm --name elastic-test -p 9200:9200 pelias/elasticsearch:5.6.12
```

### Continuous Integration
Expand Down
2 changes: 1 addition & 1 deletion integration/address_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index some docs
Expand Down
2 changes: 1 addition & 1 deletion integration/admin_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a document with all admin values
Expand Down
10 changes: 5 additions & 5 deletions integration/analyzer_peliasAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -34,7 +34,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.synonyms = function(test, common){
test( 'synonyms', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -99,7 +99,7 @@ module.exports.tests.synonyms = function(test, common){
module.exports.tests.tokenizer = function(test, common){
test( 'tokenizer', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -125,7 +125,7 @@ module.exports.tests.tokenizer = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
4 changes: 2 additions & 2 deletions integration/analyzer_peliasHousenumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasHousenumber' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -24,7 +24,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasHousenumber' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
12 changes: 6 additions & 6 deletions integration/analyzer_peliasIndexOneEdgeGram.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -65,7 +65,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.address_suffix_expansions = function(test, common){
test( 'address suffix expansions', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports.tests.address_suffix_expansions = function(test, common){
module.exports.tests.stop_words = function(test, common){
test( 'stop words', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -112,7 +112,7 @@ module.exports.tests.stop_words = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -135,7 +135,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.address = function(test, common){
test( 'address', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -159,7 +159,7 @@ module.exports.tests.address = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
60 changes: 29 additions & 31 deletions integration/analyzer_peliasPhrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -54,7 +54,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -97,7 +97,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.tokenizer = function(test, common){
test( 'tokenizer', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -124,7 +124,7 @@ module.exports.tests.tokenizer = function(test, common){
module.exports.tests.slop = function(test, common){
test( 'slop', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -142,7 +142,7 @@ module.exports.tests.slop = function(test, common){
module.exports.tests.slop_query = function(test, common){
test( 'slop query', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -179,31 +179,27 @@ module.exports.tests.slop_query = function(test, common){
function buildQuery( i ){
return {
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"match": {
"name.default": {
"query": i
}
}
"bool": {
"must": [
{
"match": {
"name.default": {
"query": i
}
],
"should": [
{
"match": {
"phrase.default": {
"query": i,
"type": "phrase",
"slop": 2
}
}
}
}
],
"should": [
{
"match": {
"phrase.default": {
"query": i,
"type": "phrase",
"slop": 2
}
]
}
}
}
]
}
}
};
Expand All @@ -213,6 +209,7 @@ module.exports.tests.slop_query = function(test, common){
suite.client.search({
index: suite.props.index,
type: 'mytype',
searchType: 'dfs_query_then_fetch',
body: buildQuery('Lake Cayuga')
}, function( err, res ){
t.equal( res.hits.total, 3 );
Expand All @@ -222,8 +219,8 @@ module.exports.tests.slop_query = function(test, common){
t.equal( hits[1]._source.name.default, 'Cayuga Lake' );
t.equal( hits[2]._source.name.default, '7991 Lake Cayuga Dr' );

t.true( hits[0]._score > hits[1]._score );
t.true( hits[1]._score > hits[2]._score );
t.true( hits[0]._score >= hits[1]._score );
t.true( hits[1]._score >= hits[2]._score );
done();
});
});
Expand All @@ -236,7 +233,7 @@ module.exports.tests.slop_query = function(test, common){
module.exports.tests.slop = function(test, common){
test( 'slop', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a document
Expand All @@ -257,6 +254,7 @@ module.exports.tests.slop = function(test, common){
suite.client.search({
index: suite.props.index,
type: 'test',
searchType: 'dfs_query_then_fetch',
body: { query: { match: {
'name.default': {
'analyzer': 'peliasPhrase',
Expand All @@ -280,7 +278,7 @@ module.exports.tests.slop = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
16 changes: 8 additions & 8 deletions integration/analyzer_peliasQueryFullToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -54,7 +54,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.address_suffix_expansions = function(test, common){
test( 'address suffix expansions', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -74,7 +74,7 @@ module.exports.tests.address_suffix_expansions = function(test, common){
module.exports.tests.stop_words = function(test, common){
test( 'stop words', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -89,7 +89,7 @@ module.exports.tests.stop_words = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -112,7 +112,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.tokenizer = function(test, common){
test( 'tokenizer', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -135,7 +135,7 @@ module.exports.tests.tokenizer = function(test, common){
module.exports.tests.slop = function(test, common){
test( 'slop', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a document
Expand Down Expand Up @@ -178,7 +178,7 @@ module.exports.tests.slop = function(test, common){
module.exports.tests.address = function(test, common){
test( 'address', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -202,7 +202,7 @@ module.exports.tests.address = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( null, { schema: schema } );
var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
var assertAnalysis = analyze.bind( null, suite, t, 'peliasQueryFullToken' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
Loading