By default, FTS only returns the document IDs (or keys) as results.
We do however provide a way for the user to extract document fields with an FTS request.
This is via the “fields” setting in the search request - I see that you’ve already included this section in your query.
For this to work - you will need the index definition to support it.
Here’s how to do this …
- Within the index index definition’s type mapping(s), while you are choosing a field to index - you will need to enable the “store” option for the field. This essentially stores the entire content of the field as is.
- Here’s how the child field mapping would need to look within your index definition -
"ContentType": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "en",
"index": true,
"name": "city",
"store": true,
"type": "text"
}
]
}
Access to FTS indexes from N1QL is only supported from couchbase-server 6.5 onwards.