Search

Search in collection

Search a collection for string matches.

The specified search query is ran for the collection. If there are too many results, the cursor id can be used to obtain the remaining results.

Note: This API is applicable for collections with search capability enabled. For user created views, use C8QL query to run search operation.

post/_fabric/{fabric}/_api/search

Request

Path parameters

fabricstring string required

The name of the fabric.

Request body

collectionstring required

Collection in which to search.

searchstring required

C8QL search query, specifying search criteria for the documents in the collection.

bindVarsobject

Bind variables for the search query.

ttlinteger

How long search results should be preserved by the server (in seconds).

Example request

{
  "collection": "my_collection",
  "search": "filter doc.URL== @URL Return doc",
  "bindVars": {
    "URL": "https://www.macrometa.com/"
  },
  "ttl": 60
}

Response

Successfully fetched search results.

codeinteger

HTTP response code.

errorboolean

Flag if there is an error in response. False for this response.

hasMoreboolean

True if more results available for the cursor on the server

countnumber

Number of matching documents.

cachedboolean

True if indicating whether the query result was served from the query cache or not

Example response

{
  "code": 200,
  "count": 1,
  "result": [
    {
      "URL": "https://www.macrometa.com/",
      "_id": "server_list/62487646",
      "_key": "62487646",
      "_rev": "_dcf-QQO--_"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.