couchdbcouchdb-lucene

How to POST queries to couchdb-lucene


I'm using couchdb-lucene and want to submit a query via POST rather than GET which the docs say is supported. However when I submit the request I get a bad_request response.

The command I'm using to submit the request:

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

The output of the command which looks correct as far as I can tell:

> 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

The response:

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

If I do the equivalent GET request everything works as expected:

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

What am I missing in the POST request?


Solution

  • Do you have a recent enough version? I just tried this locally on master and it worked fine;

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