From 4770f0660f76f10c7a5e7319eebf8e0a6b3d5e2b Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 20 May 2015 18:07:06 +0200 Subject: [PATCH] multi_match -> match --- query/search.js | 10 ++++------ test/unit/query/search.js | 30 ++++++++++++------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/query/search.js b/query/search.js index ad9f11f9..a13c156f 100644 --- a/query/search.js +++ b/query/search.js @@ -22,9 +22,8 @@ function generate( params ){ query.query.filtered.query = { 'bool': { 'must': [{ - 'multi_match': { - 'query': params.input, - 'fields': [ 'name.*' ] + 'match': { + 'name.default': params.input } }] } @@ -36,9 +35,8 @@ function generate( params ){ // add shingles should query // note: this is required for partial phrase matching query.query.filtered.query.bool.should.push({ - 'multi_match': { - 'query': params.input, - 'fields': [ 'shingle.*' ] + 'match': { + 'shingle.default': params.input } }); diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 599db6f3..9a09d29e 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -78,17 +78,15 @@ var expected = { 'bool': { 'must': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'name.*' ] + 'match': { + 'name.default': 'test' } } ], 'should': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'shingle.*' ] + 'match': { + 'shingle.default': 'test' } } ] @@ -166,17 +164,15 @@ module.exports.tests.query = function(test, common) { 'bool': { 'must': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'name.*' ] + 'match': { + 'name.default': 'test' } } ], 'should': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'shingle.*' ] + 'match': { + 'shingle.default': 'test' } } ] @@ -212,17 +208,15 @@ module.exports.tests.query = function(test, common) { 'bool': { 'must': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'name.*' ] + 'match': { + 'name.default': 'test' } } ], 'should': [ { - 'multi_match': { - 'query': 'test', - 'fields': [ 'shingle.*' ] + 'match': { + 'shingle.default': 'test' } } ]