Curl command to couchbase server

I am using below curl command to create some index on target cluster. But in response I can see some of the control-fields which i want to remove from response. Can we use any parameters if any in curl command to ignore such fields present below from the response.

(“requestID”, “metrics”, Content-Length, > Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
User-Agent: curl/7.29.0
etc.)

curl -v -uAdministrator:Administrator http://localhost:8093/query/service -d ‘statement=CREATE INDEX adv_Id ON com.src.test.bucket(en_Id,_doc)’

Output:

  • About to connect() to localhost port 8093 (#0)
  • Connected to localhost (10.75.41.157) port 8093 (#0)
  • Server auth using Basic with user ‘Administrator’

POST /query/service HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y
User-Agent: curl/7.29.0
Host: localhost:8093
Accept: /
Content-Length: 137
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 137 out of 137 bytes
    < HTTP/1.1 409 Conflict
    < Content-Length: 270
    < Content-Type: application/json; version=6.5.0-N1QL
    < Date: Wed, 22 Dec 2021 10:17:45 GMT
    <
    {
    “requestID”: “5ee13d5e-39bc-45ae-a2fd-8ed302d87175”,
    “errors”: [{“code”:4300,“msg”:“The index adv_Id already exists.”}],
    “status”: “fatal”,
    “metrics”: {“elapsedTime”: “2.031268ms”,“executionTime”: “1.983806ms”,“resultCount”: 0,“resultSize”: 0,“errorCount”: 1}
    }
  • Connection #0 to host incevfd199 left intact

curl -u Administrator:Administrator http://localhost:8093/query/service -d 'statement=CREATE INDEX adv_Id ON com.src.test.bucket(en_Id,_doc)&pretty=false&metrics=false&&signature=false'

Removing -v curl verbose options.
Some of N1QL specific can be controlled via request level settings (some you can’t avoid, but use a tool such as “jq” to filter the output.) . Settings and Parameters | Couchbase Docs

1 Like