使用ElasticSearch River搜索CouchDB
我已经用以下代码为elasticsearch创建了一条couchDB河(由此):使用ElasticSearch River搜索CouchDB,search,elasticsearch,Search,elasticsearch,我已经用以下代码为elasticsearch创建了一条couchDB河(由此): curl -XPUT 'localhost:9200/_river/tasks/_meta' -d '{ "type" : "couchdb", "couchdb" : { "host" : "localhost", "port" : 5984, "db" : "tasks", "filter" : null }, "index" : { "index" : "tasks",
curl -XPUT 'localhost:9200/_river/tasks/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "tasks",
"filter" : null
},
"index" : {
"index" : "tasks",
"type" : "tasks",
"bulk_size" : "100",
"bulk_timeout" : "10ms"
}
}'
当我尝试使用以下命令使用elasticsearch搜索couchDB时:
curl -XGET http://localhost:9200/tasks/tasks -d query{"user":"jbattle"}
我得到的答复是:
找不到uri[/tasks/tasks]和方法[GET][]的处理程序
我一直在搜索,但尚未找到解决此问题的方法
更新:
我发现正确的查询是:
curl -XGET 'http://localhost:9200/_river/tasks/_search?q=user:jbattle&pretty=true'
但是,尽管不再收到错误,我还是得到了0次点击:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
您的两个查询都不正确。第一个是缺少端点
/\u search
,第二个是查询索引\u river
,而不是索引任务
\u river
索引是存储河流的地方,而不是存储数据的地方。配置河流时,指定了索引任务
因此,请尝试以下方法:
curl -XGET 'http://localhost:9200/tasks/tasks/_search?q=user:jbattle&pretty=true'
或者,如果这不起作用,请尝试在任务/tasks
中搜索任何文档:
curl -XGET 'http://localhost:9200/tasks/tasks/_search?q=*&pretty=true'
您发布的clint已被移至github。这些家伙对让沙发和elasticsearch一起工作感到失望
不幸的是,目前被接受的答案对我来说并不适用。但如果我在浏览器的地址栏中粘贴类似的内容,它就会工作。请注意,url中只有一个对“tasks”索引的引用,而不是两个
http://localhost:9200/tasks/_search?pretty=true
要进行真正的搜索,您可以尝试以下方法:
http://localhost:9200/tasks/_search?q="hello"&pretty=true
非常感谢。你的回答恰到好处。现在,我需要研究如何对字段进行索引。再次感谢!