Elasticsearch client with couchdb support for creating index


(imad) #1

Does elasticsearch client (https://github.com/elastic/elasticsearch-js) for javascript, support creating indices for couchdb. With curl we can setcouchdb type when creating index as follows:

curl -XPUT "http://localhost:9200/_river/user_idx/_meta" -d "{
"type": "couchdb",
"couchdb": {
"host": "localhost",
"port": 5984,
"db": "users",
"filter": null
},
"index": {
"index": "user_idx",
"type": "users",
"bulk_size": "100",
"bulk_timeout": "10ms"
}
}"
I am using elasticsearch river for couch and with above code of creating index, data is filled by river seamlessly and I can get all data.

I tired this :
esClient.indices.create({index: "users_index",
body: {
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" :"5984",
"db" :"users"
},
"index" : {
"index" : "users_index",
"type" : "users",
"bulk_size" : "100",
"bulk_timeout" : "10ms"
}
}}).then(function(x){
console.log(x);
callback(null);
},
function(err){
console.log(err);
callback(null);
});

When I search for data like this in sense (GET users_index/users_index/_search), I get this without any data:

{ "took": 1, "timed_out": false, "_shards": { "total": 1, "successful": 1, "failed": 0 }, "hits": { "total": 0, "max_score": null, "hits": [] } }

With .indices.create or .index, I could not find any option to set couchdb for index. Will appreciate any
help.


(system) #2