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

Given select greeting qry example with REST API (without statement= in -d) in the doc is not working

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      It has been observed that the document in 6.5 given below statement is not working as mentioned and is getting "msg": "No statement provided".
      But works fine after providing the -d 'statement ..' (https://docs.couchbase.com/server/current/analytics/run-query.html)

      I am not sure if this is a documentation issue or a regression from earlier versions. If no issue from Analytics REST API, then this should be fixed in the documentation.

      Tested on Enterprise Edition 7.0.0 build 2465.

      Details
      --------
      In the documentation:
      "For example, you can run the query SELECT "Hello, beer!" AS greeting through curl:

      $ curl -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://localhost:8095/analytics/service

      The request returns:

      {
      "requestID": "f1b8451c-f626-46be-b1f8-e9ffc891550b",
      "signature": "*",
      "results": [

      { "greeting": "Hello, beer!" }

      ]
      ,
      "status": "success",
      "metrics":

      { "elapsedTime": "28.292741ms", "executionTime": "24.82841ms", "resultCount": 1, "resultSize": 31, "processedObjects": 0 }

      }
      "

      Actual result:

      jmunta-mac:cbtest jagadeshmunta$ curl -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://172.23.136.145:8095/analytics/service
      {
      "requestID": "90b410d6-0c48-4cfd-97d4-d937c123e12e",
      "signature":

      { "*": "*" }

      ,
      "errors": [

      { "code": 21004, "msg": "No statement provided" }


      ],
      "status": "fatal",
      "metrics":

      { "elapsedTime": "965.626µs", "executionTime": "0ns", "resultCount": 0, "resultSize": 0, "processedObjects": 0, "errorCount": 1 }

      }

      jmunta-mac:cbtest jagadeshmunta$ curl -v -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://172.23.136.145:8095/analytics/service

      • Trying 172.23.136.145...
      • TCP_NODELAY set
      • Connected to 172.23.136.145 (172.23.136.145) port 8095 (#0)
      • Server auth using Basic with user 'Administrator'
        > POST /analytics/service HTTP/1.1
        > Host: 172.23.136.145:8095
        > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
        > User-Agent: curl/7.54.0
        > Accept: /
        > Content-Length: 33
        > Content-Type: application/x-www-form-urlencoded
        >
      • upload completely sent off: 33 out of 33 bytes
        < HTTP/1.1 400 Bad Request
        < connection: keep-alive
        < content-type: application/json; charset=UTF-8
        < content-length: 336
        <
        {
        "requestID": "c82e4f75-6319-47d7-8cff-d5c8c15f50bf",
        "signature": { "*": "*" }

        ,
        "errors": [

        { "code": 21004, "msg": "No statement provided" }


        ],
        "status": "fatal",
        "metrics":

        { "elapsedTime": "984.163µs", "executionTime": "0ns", "resultCount": 0, "resultSize": 0, "processedObjects": 0, "errorCount": 1 }

        }

      • Connection #0 to host 172.23.136.145 left intact

      Only works when statement= is given.

      jmunta-mac:cbtest jagadeshmunta$ curl -v -u Administrator:password -d 'statement=SELECT "Hello, beer!" AS greeting;' http://172.23.136.145:8095/analytics/service

      • Trying 172.23.136.145...
      • TCP_NODELAY set
      • Connected to 172.23.136.145 (172.23.136.145) port 8095 (#0)
      • Server auth using Basic with user 'Administrator'
        > POST /analytics/service HTTP/1.1
        > Host: 172.23.136.145:8095
        > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
        > User-Agent: curl/7.54.0
        > Accept: /
        > Content-Length: 44
        > Content-Type: application/x-www-form-urlencoded
        >
      • upload completely sent off: 44 out of 44 bytes
        < HTTP/1.1 200 OK
        < transfer-encoding: chunked
        < connection: keep-alive
        < content-type: application/json; charset=UTF-8
        < Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
        <
        {
        "requestID": "ff0340d9-6e29-4543-87b3-c9aa72c89936",
        "signature": { "*": "*" }

        ,
        "results": [

        { "greeting": "Hello, beer!" }

        ]
        ,
        "plans":{},
        "status": "success",
        "metrics":

        { "elapsedTime": "25.927011ms", "executionTime": "16.213578ms", "resultCount": 1, "resultSize": 31, "processedObjects": 0 }

        }

      • Connection #0 to host 172.23.136.145 left intact

      Attachments

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

        Activity

          Hi Jagadesh Munta,
          this has been addressed in DOC-6910, but apparently it hasn't been merged forward yet.

          till Till Westmann added a comment - Hi Jagadesh Munta , this has been addressed in DOC-6910 , but apparently it hasn't been merged forward yet.

          Thanks Till.

          jagadesh.munta@couchbase.com Jagadesh Munta added a comment - Thanks Till.
          michael.blow Michael Blow added a comment -

          This is merged forward to all branches, including 6.5.x-docs, mad-hatter (6.6), & master (cheshire-cat). You may need to contact to doc team to get the website docs regenerated, not sure if that's automatic or not.

          michael.blow Michael Blow added a comment - This is merged forward to all branches, including 6.5.x-docs, mad-hatter (6.6), & master (cheshire-cat). You may need to contact to doc team to get the website docs regenerated, not sure if that's automatic or not.

          Bulk closing invalid, duplicate and won't fix bugs

          raju Raju Suravarjjala added a comment - Bulk closing invalid, duplicate and won't fix bugs

          People

            jagadesh.munta@couchbase.com Jagadesh Munta
            jagadesh.munta@couchbase.com Jagadesh Munta
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty