From cb7d22df91efff84c7d056dde93b7eded8095453 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 24 Sep 2015 17:05:10 -0400 Subject: [PATCH] switched ES lookup field from "type" -> "_type", fixes issue with /place lookup on Eiffel Tower gid --- controller/place.js | 9 ++------- test/unit/controller/place.js | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/controller/place.js b/controller/place.js index 101430c5..e24be2fc 100644 --- a/controller/place.js +++ b/controller/place.js @@ -19,13 +19,8 @@ function setup( backend ){ /* * some gids aren't resolvable to a single type (ex: osmnode and osmway * both have source osm and layer venue), so expect an array of - * possible values. It's important to use `type` here instead of - * `_type`, as the former actually queries against the type, and thus - * can accept multiple match values. `_type`, on the other hand, - * simply changes the actual URL of the query sent to Elasticsearch to - * contain a type, which obviously can only take a single type. - */ - type: id.types, + * possible values. */ + _type: id.types, _id: id.id }; }); diff --git a/test/unit/controller/place.js b/test/unit/controller/place.js index 20455e3a..1d38f5d5 100644 --- a/test/unit/controller/place.js +++ b/test/unit/controller/place.js @@ -41,7 +41,7 @@ module.exports.tests.functional_success = function(test, common) { test('functional success', function(t) { var backend = mockBackend( 'client/mget/ok/1', function( cmd ){ - t.deepEqual(cmd, { body: { docs: [ { _id: 123, _index: 'pelias', type: [ 'a' ] } ] } }, 'correct backend command'); + t.deepEqual(cmd, { body: { docs: [ { _id: 123, _index: 'pelias', _type: [ 'a' ] } ] } }, 'correct backend command'); }); var controller = setup( backend ); var res = { @@ -70,7 +70,7 @@ module.exports.tests.functional_success = function(test, common) { module.exports.tests.functional_failure = function(test, common) { test('functional failure', function(t) { var backend = mockBackend( 'client/mget/fail/1', function( cmd ){ - t.deepEqual(cmd, { body: { docs: [ { _id: 123, _index: 'pelias', type: [ 'b' ] } ] } }, 'correct backend command'); + t.deepEqual(cmd, { body: { docs: [ { _id: 123, _index: 'pelias', _type: [ 'b' ] } ] } }, 'correct backend command'); }); var controller = setup( backend ); var req = { clean: { ids: [ {'id' : 123, types: [ 'b' ] } ] }, errors: [], warnings: [] };