Closed onstrike07 closed 8 years ago
Awesome, confirmed! I just changed the version from elasticsearch back to the same on 1.0.4 which is "elasticsearch": "^8.1.0"
and it worked again.
the master
version has even a higher dependency. ^11.0.1
, So it's a matter of releasing a new version of the connector.
Thanks.
Step 5 has been added.
@juanpujol - so ^11.0.1
is bad for you, compared to ^8.1.0
?
Please confirm ... because it would be strange, given that I trust ES folks to release backward compatible versions of their clients ... I may need to have a closer look and document this in README as an explicit corner case ... if this is true.
Oh wait, I never released 1.0.6
and 1.0.5
has really old es client 2.4.3
something ... I will work towards releasing/publishing a new version of connector with the fix.
@pulkitsinghal ^11.0.1
works fine too. We just need a new release from master. Thanks.
1.0.6
was released
Process to produce this issue:
I'm using the latest Elasticsearch which is 2.3.4.
The error message in title is shown.
C:\Users\test\myEsConnector\examples>node server\server.js loopback deprecated loopback.compress is deprecated. Use require('compression'); instead. server\server.js:10:17 C:\Users\test\myEsConnector\examples\node_modules\loopback\lib\application.js:243 throw err; ^ RangeError: Cannot create data source "elasticsearch-plain": Cannot initialize connector "es": Maximum call stack size exceeded at Function.EventEmitter.listenerCount (events.js:397:38) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25) at Function.EventEmitter.listenerCount (events.js:399:20) at Log.listenerCount (C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:68:25)
Workaround
The connector was only written and tested with ES v1.1, and the version of es-client downloaded as a dependency of es-connector on my computer was one that only supported up to v1.3, but I was running v2.3.4. In addition, the example was loading the es-connector version 0.3.2 rather that the latest 1.0.5.
Following are steps on how to fix it:
1 Manually delete the elasticsearch folder from the folder below:
_C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\nodemodules
2 Edit _C:\Users\test\myEsConnector\examples\nodemodules\loopback-connector-es\package.json file to remove the explicit reference to elasticsearch.
3 Run npm install --save --save-exact elasticsearch under the folder below:
_C:\Users\test\myEsConnector\examples\node_modules\loopback-connector-es\nodemodules
4 Modify examples/server/datasource.json file like shown below
{ "db": { "name": "db", "connector": "memory", "file": "db.json" }, "elasticsearch-plain": { "name": "elasticsearch-plain", "connector": "es", "index": "shakespeare", "hosts": [ { "host": "localhost", "port": 9200 } ], "apiVersion": "2.3", "log": "trace", "defaultSize": 50, "requestTimeout": 30000 } }
5 Edit server/model-config.json file to replace data source name 'elasticsearch-ssl' with 'elasticsearch-plain'.
The error should be gone. I'm having other issues; I'm not sure if they are related to different versions of ES and the connector. I'll be working on them.