elasticsearch/elasticsearch — Issue #1512: CouchDB river : Add support for views
Author: dadoonet
Created: 2011-11-29 22:21:07+00:00
State: open

Real implementation of pull request #1258, as there was a problem with GitHub.

In CouchDB, you can retrieve docs by `GET`, `_changes` API and views.
CouchDB river uses `_changes` API to get documents.

I would like to be able to get documents that changed (getting ID with the _changes API) using a view with parameter `key="DOCID"`.

As views return a collection of results (aka rows), we will index in ES each row with an id like DOCID_seq where seq is the sequence number of each row.
If you get back 3 rows for one single change for document with ID=1234, the river will index 3 documents :

* 1234_1
* 1234_2
* 1234_3

To use it, you have to define a view in couchDB. For instance, `_design/vues/_view/test_dpi` with

```javascript
function(doc) {
listArt=doc.document.articles;

for(var i=0; i