如何将查询POST到couchdb-lucene

时间:2014-10-15 20:41:00

标签: couchdb couchdb-lucene

我使用的是couchdb-lucene,想要通过POST而不是GET提交查询,the docs表示支持。但是,当我提交请求时,我会收到bad_request响应。

我用来提交请求的命令:

curl -v -X POST -d 'q=form:P' http://gareth:pass@localhost:5984/_fti/local/medic/_design/medic/data_records

该命令的输出看起来正确,据我所知:

> POST /_fti/local/medic/_design/medic/data_records?debug=true HTTP/1.1
> Authorization: Basic Z2FyZXRoOnBhc3M=
> User-Agent: curl/7.35.0
> Host: localhost:5984
> Accept: */*
> Content-Length: 8
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 8 out of 8 bytes

回应:

{"reason":"bad_request","code":400}

如果我执行等效的GET请求,一切都按预期工作:

curl -v http://user:pass@localhost:5984/_fti/local/medic/_design/medic/data_records?q=form:P
{"limit":25,"etag":"235dad97d63","fetch_duration":0, ....

POST请求中缺少什么?

1 个答案:

答案 0 :(得分:1)

你有最新的版本吗?我刚刚在master上尝试了这个,它运行良好;

curl 'localhost:5984/_fti/local/db1/_design/couchapp/idx' -d 'q=*:*'
{"q":"*:*","fetch_duration":....