drakerian / loopback-connector-elastic-search

Strongloop Loopback connector for Elasticsearch
MIT License
33 stars 86 forks source link

Bad request about DELETE #11

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi,

When I do a delete using explorer, the curl request is :

curl -X DELETE --header "Accept: application/json" "https://domain.com/api/items/AVRN9YTgQpzsefUO2miC"

This fail with :

{
  "error": {
    "name": "TypeError",
    "status": 500,
    "message": "self.db.deleteByQuery is not a function",
    "stack": "TypeError: self.db.deleteByQuery is not a function\n    at destroyAll (/opt/development/node_modules/loopback-connector-es/lib/esConnector.js:796:13)\n    at doDelete (/opt/development/node_modules/loopback-datasource-juggler/lib/dao.js:1740:19)\n    at /opt/development/node_modules/loopback-datasource-juggler/lib/dao.js:1714:11\n    at doNotify (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:93:49)\n    at doNotify (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:93:49)\n    at doNotify (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:93:49)\n    at doNotify (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:93:49)\n    at Function.ObserverMixin._notifyBaseObservers (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:116:5)\n    at Function.ObserverMixin.notifyObserversOf (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:91:8)\n    at Function.ObserverMixin._notifyBaseObservers (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:114:15)\n    at Function.ObserverMixin.notifyObserversOf (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:91:8)\n    at Function.ObserverMixin._notifyBaseObservers (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:114:15)\n    at Function.ObserverMixin.notifyObserversOf (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:91:8)\n    at Function.ObserverMixin._notifyBaseObservers (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:114:15)\n    at Function.ObserverMixin.notifyObserversOf (/opt/development/node_modules/loopback-datasource-juggler/lib/observer.js:91:8)\n    at /opt/development/node_modules/loopback-datasource-juggler/lib/dao.js:1712:15"
  }
}

But if I execute the right request directly to elasticsearch, it's ok and this is the request :

curl -XDELETE 'http://localhost:9200/items/item/AVRN9YTgQpzsefUO2miC'

Reference : Delete API

Thanks

pulkitsinghal commented 8 years ago

@colundrum - try this fork/repo instead: https://github.com/strongloop-community/loopback-connector-elastic-search

And join the community discussions at: https://gitter.im/strongloop-community/loopback-connector-elastic-search