Browse Source

switching searchType from the default 'query_then_fetch' to 'dfs_query_then_fetch' because we have multiple shards in prod http://www.elasticsearch.org/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch/

using-pelias-ngram
Harish Krishna 10 years ago
parent
commit
ff9e9973fc
  1. 1
      controller/search.js
  2. 4
      test/unit/controller/search.js

1
controller/search.js

@ -13,6 +13,7 @@ function setup( backend, query ){
// backend command // backend command
var cmd = { var cmd = {
index: 'pelias', index: 'pelias',
searchType: 'dfs_query_then_fetch',
body: query( req.clean ) body: query( req.clean )
}; };

4
test/unit/controller/search.js

@ -53,7 +53,7 @@ module.exports.tests.functional_success = function(test, common) {
test('functional success', function(t) { test('functional success', function(t) {
var backend = mockBackend( 'client/search/ok/1', function( cmd ){ var backend = mockBackend( 'client/search/ok/1', function( cmd ){
t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias' }, 'correct backend command'); t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias', searchType: 'dfs_query_then_fetch' }, 'correct backend command');
}); });
var controller = setup( backend, mockQuery() ); var controller = setup( backend, mockQuery() );
var res = { var res = {
@ -78,7 +78,7 @@ module.exports.tests.functional_success = function(test, common) {
module.exports.tests.functional_failure = function(test, common) { module.exports.tests.functional_failure = function(test, common) {
test('functional failure', function(t) { test('functional failure', function(t) {
var backend = mockBackend( 'client/search/fail/1', function( cmd ){ var backend = mockBackend( 'client/search/fail/1', function( cmd ){
t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias' }, 'correct backend command'); t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias', searchType: 'dfs_query_then_fetch' }, 'correct backend command');
}); });
var controller = setup( backend, mockQuery() ); var controller = setup( backend, mockQuery() );
var next = function( message ){ var next = function( message ){

Loading…
Cancel
Save