ncb000gt / node-es

NodeJS module for ElasticSearch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New percolator support

randunel opened this issue · comments

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

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

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.

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.

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

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