ncb000gt / node-es

NodeJS module for ElasticSearch.
103 stars 81 forks source link

New percolator support #38

Closed randunel closed 10 years ago

randunel commented 11 years ago

Are there plans to support the new percolator api? (.percolate)

http://www.elasticsearch.org/blog/percolator-redesign-blog-post/

brozeph commented 11 years ago

It appears that the new percolator will be available in the 1.0 beta version of Elasticsearch. To support this, one change will be necessary to the component. Will keep this issue open as a note, but will hold on implementing changes until specified version of Elasticsearch is released.

Register Percolator

core.registerPercolator (https://github.com/ncb000gt/node-es/blob/master/lib/core.js#L447)

Instead of using the POST method, PUT should be used instead. Additionally, the URL will need to be restructured slightly as the _type must be specified as .percolator, the _percolator portion of the URL (that prefixes the _index and name portion of the URL) should be removed.

Execute Percolator

core.percolate (https://github.com/ncb000gt/node-es/blob/master/lib/core.js#L419)

This portion of code appears to require no change in order to support new functionality.

randunel commented 11 years ago

I think the new percolator registration can be simulated via

es.index( {
    _index: 'myindex',
    _type: '.percolator',
    _id: id
}, query, callback)

But I may be wrong, since the presence of _id may append a _create to the url, not sure though.

randunel commented 10 years ago

The unregisterPercolator also changed, and can be simulated with es.delete({_type: '.percolator' [...].

brozeph commented 10 years ago

Update: Adding support for percolator changes in v0.4.1 of this module