mirror of https://github.com/pelias/api.git
Stephen Hess
8 years ago
4 changed files with 7 additions and 16 deletions
@ -1,14 +1,5 @@ |
|||||||
var config = require( 'pelias-config' ).generate().esclient; |
const config = require( 'pelias-config' ).generate().esclient; |
||||||
var Backend = require('geopipes-elasticsearch-backend'), |
const Backend = require('geopipes-elasticsearch-backend'); |
||||||
client = require('elasticsearch').Client(config), |
const client = require('elasticsearch').Client(config); |
||||||
backends = {}; |
|
||||||
|
|
||||||
function getBackend( index, type ){ |
module.exports = new Backend(client); |
||||||
var key = ( index + ':' + type ); |
|
||||||
if( !backends[key] ){ |
|
||||||
backends[key] = new Backend( client, index, type ); |
|
||||||
} |
|
||||||
return backends[key]; |
|
||||||
} |
|
||||||
|
|
||||||
module.exports = getBackend; |
|
||||||
|
Loading…
Reference in new issue