Search Service

    +
    The Search Service provides a full-text indexing and search engine for cluster data.

    About the Search Service

    The Search Service — also referred to as Full Text Search (or FTS) — provides extensive capabilities for natural-language querying.

    Deploying the Search Service on a cluster allows you to create, manage, and query specially purposed indexes that enable Google-like search capabilities on JSON documents within a bucket. These capabilities include:

    • Language-aware searching; allowing users to search for, say, the word beauties, and additionally obtain results for beauty and beautiful.

    • Scoring of results, according to relevancy; allowing users to obtain result-sets that only contain documents awarded the highest scores. This keeps result-sets manageably small, even when the total number of documents returned is extremely large.

    • Fast indexes, which support a wide range of possible text-searches.

    For example, the query below looks for documents with all of the strings (paris, notre, dame).

    {
      "explain": false,
      "fields": [
        "*"
      ],
      "highlight": {},
      "query": {
        "query": "+paris +notre +dame"
       }
    }

    This query returns the following result (shown partially) from the FTS index scan on the travel-sample sample bucket. For each matched document, the hits field shows the document id, the score, the fields in which a matched string occurs, and the position of the matched string.

    "hits": [
        {
          "index": "trsample_623ab1fb8bfc1297_6ddbfb54",
          "id": "landmark_21603",
          "score": 2.1834097375254955,
          "locations": {
            "city": {
              "paris": [
                {
                  "pos": 1,
                  "start": 0,
                  "end": 5,
                  "array_positions": null
                }
              ]
            },
            "content": {
              "dame": [
                {
                  "pos": 23,
                  "start": 169,
                  "end": 173,
                  "array_positions": null
                },
    ...
    ]

    The indexes that the Search Service creates and uses are entirely separate from and different to those of the Index Service. However, if the Index Service and Query Service are also deployed on the cluster, the facilities of the Search Service can be called on by means of the N1QL language — which provides the principal interface to the Query and Index Services. This is principally done through the use of Search Functions.

    Using the Search Service

    Like the other Couchbase services, the Search Service can be deployed during cluster creation, or by adding it to an existing cluster. The Search Service depends on the Data Service. This service must also be deployed on the cluster in order to use the Search Service. (Information about how these services interact with one another can be found in the Couchbase Server documentation.)

    If a cluster has the Search Service deployed, Full Text Indexes can be managed and searched from the Couchbase Cloud UI or by using the Couchbase SDK. In addition, if the Query Service is also deployed on the cluster, Full Text Indexes can be searched via the Query Workbench through the use of Search Functions.