Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-8407

document support of and requirement to switch to POST from GET when params get long

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.1.0
    • 2.0, 2.0.1
    • None
    • Security Level: Public
    • None

    Description

      It was recently found that view requests must use POST if arguments get long, but there is not currently any mention of this in our HTTP view interface documentation.

      From the recent discussion:

      On Tue, Jun 4, 2013 at 2:33 AM, Mark Nunberg <Mark.Nunberg@couchbase.com> wrote:
      > Hi folks

      > A user recently notified me he has had to use POST requests for view
      > queries because the query parameters for his GET request seems to exceed
      > some limit and the server ends up responding with an HTTP 400.

      Yes. I told that recently to someone in the forum:

      http://www.couchbase.com/forums/thread/key-limit-view-queries

      Any http server, including the one we use (mochiweb), has some limit
      for URI lengths. For mochiweb, if I recall correctly the limit is
      around 4Kb or 8Kb (including the query string part of the URI).

      The only supported parameter in a POST body is "keys", as this is the
      one more likely to exceed such limits.
      Example:

      curl -X POST -H 'Content-Type: application/json' -gs
      'http://localhost:8092/default/_design/test/_view/view1?stale=false'
      -d '

      {"keys": [1, 5, 9]}

      '

      > So there are two things I'm wondering:

      > 1) Is sending queries as POST supported? This is apparently what CouchDB
      > does (according to the user), and it seems to work for him, however I
      > can't find mention of this anywhere in our own docs

      Yes. In general we support almost everything that CouchDB supports,
      and with the same API.

      > 2 ) If it is supported, is there any performance hit in using POST over
      > GET (I'm guessing not, but thought I'd ask)

      I don't think so. But I never measured it anyway.
      Here probably doesn't matter much - the user is likely more interested
      in having his query work with a single request - which will be faster
      than several GET requests with a subset of the keys.

      > Regards,
      > Mark

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kzeller kzeller
            ingenthr Matt Ingenthron
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty