The issue is with your analyzer, please use this tool and recreate your custom analyzer and test it https://bleveanalysis.couchbase.com/analysis - I did and then I supplied
aaa:100000@190800
As you can see the “:” and the “@” are removed.
Now let’s try a keyword analyzer
Note FTS uses Golang regex syntax Using the OnPrem or Capella UI try a FTS query like:
{ "regexp": "aaa.[0-9]+.[0-9]+", "field": "modelAIR" }
I use “.” to match the “:” and the “@” characters above you will get your match.
I admit I have issues matching “:” and the “@” characters so I chose the golang regex syntax for punctuation (== [!-/:-@[-`{-~]) the follwoing will still work.
{ "regexp": "aaa[[:punct:]][0-9]+[[:punct:]][0-9]+", "field": "modelAIR" }
Next I used the HEX method in golang regex syntax for “:”
{ "regexp": "aaa\\x3A[0-9]+[[:punct:]][0-9]+", "field": "modelAIR" }
Because it is in a string I had to escape the backslash. Then for “@”
{ "regexp": "aaa\\x3A[0-9]+\\x40[0-9]+", "field": "modelAIR" }
Because it is in a string I had to escape the backslash. So the final Regex is as follows:
Here is your working index, note I overrode the key field you are searching on to a keyword analyzer:
If you just want a prefix (similar to the start of this thread) aaaa:100 try
{ "regexp": "aaa\\x3A100.+", "field": "modelAIR" }
or if you are looking for a prefix of aaaa:100@
{ "regexp": "aaa\\x3A100\\x40.+", "field": "modelAIR" }
Your final definition is below
{
"type": "fulltext-index",
"name": "forum._default.models_meta",
"sourceType": "gocbcore",
"sourceName": "models_meta",
"planParams": {
"maxPartitionsPerPIndex": 1024,
"indexPartitions": 1
},
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": ".*",
"mode": "docid_regexp",
"type_field": "type"
},
"mapping": {
"analysis": {
"analyzers": {
"en-without-stop-words": {
"token_filters": [
"to_lower",
"possessive_en"
],
"tokenizer": "unicode",
"type": "custom"
}
}
},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": true,
"properties": {
"modelAIR": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "keyword",
"docvalues": true,
"index": true,
"name": "modelAIR",
"store": true,
"type": "text"
}
]
}
}
},
"default_type": "_default",
"docvalues_dynamic": false,
"index_dynamic": true,
"store_dynamic": false,
"type_field": "_type"
},
"store": {
"indexType": "scorch",
"segmentVersion": 15
}
},
"sourceParams": {}
}
The above only updates the analyzer for the field “modelAIR”, FTS is very powerful but the devil is in the details.
Best
Jon Strabala
Principal Product Manager - Server