Hits is empty but rows contains result ids

NEW TO Couchbase

I created an index in the web console named primary-index for my collection.

index config

 "name": "primary-index",
 "type": "fulltext-index",
 "params": {
  "doc_config": {
   "docid_prefix_delim": "",
   "docid_regexp": "",
   "mode": "type_field",
   "type_field": "type"
  "mapping": {
   "analysis": {
    "token_filters": {
     "length": {
      "min": 3,
      "max": 255,
      "type": "length"
   "default_analyzer": "standard",
   "default_datetime_parser": "dateTimeOptional",
   "default_field": "_all",
   "default_mapping": {
    "dynamic": true,
    "enabled": true
   "default_type": "_default",
   "docvalues_dynamic": true,
   "index_dynamic": true,
   "store_dynamic": false,
   "type_field": "_type"
  "store": {
   "indexType": "scorch"
 "sourceType": "couchbase",
 "sourceName": "ads",
 "sourceUUID": "cd5969df032f3dc0aa866b189d502839",
 "sourceParams": {},
 "planParams": {
  "maxPartitionsPerPIndex": 171,
  "indexPartitions": 6,
  "numReplicas": 0
 "uuid": "22e0659c83a017fb"

And when I execute the search from the nodejs SDK

function search(query) {
  return cluster.searchQuery(

the following results return but the hit is empty and rows contain the result id and score data

  meta: {
    status: { total: 6, failed: 0, successful: 6 },
    request: {
      query: [Object],
      size: 10,
      from: 0,
      highlight: null,
      fields: null,
      facets: null,
      explain: false,
      sort: [Array],
      includeLocations: false,
      search_after: null,
      search_before: null
    hits: [],
    total_hits: 2,
    max_score: 0.05511239428543268,
    took: 999600,
    facets: null
  rows: [
      index: 'primary-index_c7d8134e4c7761c6_18572d87',
      id: 'bf006cf4-93f3-4237-bff3-cf44fd213d81',
      score: 0.05511239428543268,
      sort: [Array]
      index: 'primary-index_c7d8134e4c7761c6_aa574717',
      id: 'f219ef9e-c183-451c-8df0-735721a0d903',
      score: 0.05424442643471465,
      sort: [Array]

Why result don’t contain collections fields eg: title, description ?

one of the collection

  "category": {
    "field": "device",
    "item": "phone & tablet accessories"
  "location": {
    "district": "Ampara",
    "city": "Akkarepattu"
  "title": "Samsung original hands free ",
  "description": "The first thing I did ",
  "price": 15000,
  "condition": "new",
  "brand": "Samsung ",
  "negotiable": true

The couchbase FTS Index will by default only return document IDs as hits. If you wish to fetch other fields as part of the response, you would need to “store” them when you define your index.

Here’s documentation to help you set up your indexes …

Now, once you’ve set up your index and check boxed the store option for fields you want retrieved as part of the response, you will need to explicitly set the field names in the search request as well within the “Fields” section.

Here’s documentation to assist you with search requests …

1 Like

after setting my index in web console and then set field names in search request and now I get the fields in hit, Happy : -)

function search(q) {
  const SearchQuery = couchbase.SearchQuery;

  const query = SearchQuery.new("search", SearchQuery.term(q)).fields("*");

  bucket.query(query, (error, result, meta) => {
    console.log("search -> meta", meta);
    console.log("search -> result", result);
    console.log("search -> error", error);