drakerian / loopback-connector-elastic-search

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

not returning correct results #4

Open prasad0405 opened 9 years ago

prasad0405 commented 9 years ago

Swagger UI method: get /workorders/{id} Find a model instance by id from the data source

URL:

http://deveisvm3.dev.denverwater.org:2900/work/v1/workorders/15-111745

trace logs:

Elasticsearch DEBUG: 2015-03-17T18:26:25Z starting request { method: 'POST', path: '/work/WorkOrder/_search', query: { where: { workOrderNumber: '15-111745' }, limit: 1, offset: 0, skip: 0 } }

Elasticsearch TRACE: 2015-03-17T18:26:25Z -> POST http://devtsttibco02.denverwater.org:9200/work/WorkOrder/_search?where=&limit=1&offset=0&skip=0

The URL getting posted is not a valid one (where is empty below) and i don't see where as part of query/filter dsl in elastic search

http://devtsttibco02.denverwater.org:9200/work/WorkOrder/_search?where=&limit=1&offset=0&skip=0

pulkitsinghal commented 9 years ago

@prasad0405 - I need this module too ... so I am attempting to fix this stuff on my own, head over to the https://github.com/shoppinpal/loopback-connector-elastic-search fork and open an issue there? Afterwards I'll publish an alternative to NPM.

pulkitsinghal commented 9 years ago

@prasad0405 - if you look at the example in https://github.com/shoppinpal/loopback-connector-elastic-search ... you should see a way to setup your index mappings and the where clause should work properly, please confirm if it satisfies your use case after testing.

pulkitsinghal commented 9 years ago

@prasad0405 - also I was looking at the tests in @drakerian's implementation and its my guess that he/she favored the simplicity of using ES's DSL over all the conversions that would be involved if he used the loopback syntax: https://github.com/drakerian/loopback-connector-elastic-search/blob/master/test/filter-test.js#L25