zackiles / elasticsearch-odm

Like Mongoose but for Elasticsearch. Define models, preform CRUD operations, and build advanced search queries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect example fails with "TypeError: ConnectionError is not a function"

d4goxn opened this issue · comments

To reproduce:

elasticsearch = require("elasticsearch-odm");
elasticsearch.connect("test-index");
Unhandled rejection TypeError: ConnectionError is not a constructor
    at createIndex (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/index.js:84:44)
    at /home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/index.js:62:14
    at bound (domain.js:280:14)
    at runBound (domain.js:293:12)
    at tryCatcher (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/promise.js:503:31)
    at Promise._settlePromiseAt (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/promise.js:577:18)
    at Promise._settlePromises (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/promise.js:693:14)
    at Async._drainQueue (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/dan/Projects/kasra2/web-app/node_modules/elasticsearch-odm/node_modules/bluebird/js/main/async.js:15:14)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

Elasticsearch server info:

$ curl 'localhost:9200'
{
  "name" : "Human Torch",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.4",
    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
    "build_timestamp" : "2016-06-30T11:24:31Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}

Checked on Node v6.3 and v4.3.

Observations

  • The index did not already exist, but if something is wrong with the ES server, this isn't the place to troubleshoot that
  • Filling out an options object for the connect call produces the same result
  • Logging ConnectionError from index.js, just after the requires, shows that it is undefined

Wait, maybe this doesn't actually support Elasticsearch v2? I see that there is a fork at https://github.com/bloublou2014/elasticsearch-odm with a bunch of activity on a es-2.x branch. Hopefully that merges back in when it is ready :)

Hello, Yes branch works with ES2.x, and has been updated (test & code).
Issue #4 request help but zackiles has not answered yet. if still no answer within a week i will publish a elasticsearch-odm-es2 to npm.

Sorry for delay, it's been merged now!