Run A Simple Search with the Web Console

  • how-to
    +
    Run a Search query from the Couchbase Server Web Console to preview the search results from a Search index.

    For more information about how the Search Service scores documents in search results, see Scoring for Search Queries.

    Prerequisites

    • You have the Search Service enabled on a node in your database. For more information about how to deploy a new node and Services on your database, see Manage Nodes and Clusters.

    • You have a bucket with scopes and collections in your database. For more information about how to create a bucket, see Create a Bucket.

    • You have created a Search index.

      For more information about how to create a Search index, see Create a Search Index.

    • Your user account has the Search Admin or Search Reader role.

    • You have logged in to the Couchbase Server Web Console.

    Procedure

    To run a simple search with the Couchbase Server Web Console:

    1. Go to Search.

    2. Click the index where you want to run a search.

    3. In the Search this index field, enter a search query.

    4. Press Enter or click Search.

    5. (Optional) To view the full contents of a document returned in the search results, click one of the results.

    6. (Optional) To view the results of document scoring in search results, click Show Scoring.

    7. (Couchbase Server version 7.6.2 and later) To directly edit the Search request JSON payload for your Search query and run a new search:

      1. Click show advanced query settings.

      2. Click Edit.

      3. Edit the JSON payload. For more information about the available parameters, see Search Request JSON Properties.

      4. Click Execute.

    Example

    For example, the following query searches for the strings view, food, and beach:

    {
        "explain": true,
        "fields": [
          "*"
        ],
        "highlight": {},
        "query": {
          "query": "+view +food +beach"
        },
        "size": 10,
        "from": 0
    }

    The query payload enables scoring explanations and term highlighting. It also returns all available fields in the index, and returns 10 results per page.

    Use a Search index alias to search multiple Search indexes in a single search query. Use the collections parameter in your request to specify an array of collections to search from the Search index.

    Next Steps

    If you do not get the search results you were expecting, you can change the JSON payload for your Search query. If your database is running Couchbase Server version 7.6.2 and later, you can edit the JSON payload directly in the UI by clicking show advanced query settings.

    Run any changes to your JSON payload by clicking Execute.