Indexing and searching in FTS

Ok,Ii got my FTS geo search working but I would like to search for more like limit on Zip code and street names as well on _type.

My document looks like this

{
“_id” :"xxx,
“_type”: “Residential”,
“_geo” : {“lat”: 123, “lng”: 345},
“Record” : {
“Address”: {
“City”: “Los Angeles”,
“Country”: “US”,
“PostalCode”: “90017”,
“PostalCodePlus4”: “5711”,
“StateOrProvince”: “CA”,
“StreetDirPrefix”: “W”,
“StreetDirSuffix”: “”,
“StreetName”: “7th”,
“StreetNumber”: “”,
“StreetNumberNumeric”: “818”
} }}

What i am struggling is how to create an index for example for PostalCode and StreetName. To i create an index on Record.Address.PostalCode and then specify Record.Address.PostalCode as the field i want to match or do i create.

Like this

or this


Also how high is the performance Hit if i would Index The whole Object Record.Address and would i still be able to search / match values on individual fields. ’
Another question is how would i tell FTS which index to use if a bucket has multiple Indexes as the Index to use is specified in the URL if i do a CURL but i have not seen anything if i do a N1QL query with where search (…)

Here is what the index i played around with without geo index …

{
“name”: “CRML_RES”,
“type”: “fulltext-index”,
“params”: {
“doc_config”: {
“docid_prefix_delim”: “”,
“docid_regexp”: “”,
“mode”: “type_field”,
“type_field”: “_type”
},
“mapping”: {
“default_analyzer”: “standard”,
“default_datetime_parser”: “dateTimeOptional”,
“default_field”: “_all”,
“default_mapping”: {
“dynamic”: true,
“enabled”: false
},
“default_type”: “_default”,
“docvalues_dynamic”: true,
“index_dynamic”: true,
“store_dynamic”: false,
“type_field”: “_type”,
“types”: {
“Record”: {
“dynamic”: false,
“enabled”: true,
“properties”: {
“Address”: {
“dynamic”: false,
“enabled”: true,
“properties”: {
“PostalCode”: {
“enabled”: true,
“dynamic”: false,
“fields”: [
{
“docvalues”: true,
“include_in_all”: true,
“include_term_vectors”: true,
“index”: true,
“name”: “PostalCode”,
“store”: true,
“type”: “text”
}
]
}
}
}
}
},
“Record.Address.PostalCode”: {
“dynamic”: true,
“enabled”: true
},
“_type”: {
“dynamic”: false,
“enabled”: true
}
}
},
“store”: {
“indexType”: “scorch”
}
},
“sourceType”: “couchbase”,
“sourceName”: “rets”,
“sourceUUID”: “68ba50313fd833d089e0c9704188988f”,
“sourceParams”: {},
“planParams”: {
“maxPartitionsPerPIndex”: 171,
“indexPartitions”: 6,
“numReplicas”: 0
},
“uuid”: “70574e5fa3b5fedc”
}

You could index nested JSON objects by inserting child-type mappings or as your former example.
It may not be a bad idea to refer to the Couchbase/FTS documentation or google on this to get some useful information.

https://docs.couchbase.com/server/current/fts/fts-creating-indexes.html#inserting-a-child-mapping

Search performance usually shouldn’t be a concern for querying multiple fields using a conjuncts/other compound queries.
https://docs.couchbase.com/server/current/fts/fts-query-types.html#conjunction-query-and

User doesn’t have to explicitly specify the name of the FTS index to pick – N1QL will determine which is the best index among the available ones to run the FTS query against. If one wants N1QL to use a specific index (for example – an index named “test”), here’s how ,

SELECT meta().id
FROM `travel-sample` as t
WHERE SEARCH(t, {“match_phrase”: “San Francisco”, “field”: “city”}, {“index”: “test”});

refer - Introducing FTS with N1QL | The Couchbase Blog