hi @The_Cimmerian,
One way to achieve this is by using a custom analyser which uses shingle based token filters for the field you wanted to query.
ref - Understanding Analyzers | Couchbase Docs
Word shingles of min/max (2/3 words) basically form tokens like below for a given text “aero dynamic freight” provided one chose to keep the input tokens as it is. (That is an option while creating the custom shingle token filters in the UI)
Blockquote
aero dynamic freight => aero, dynamic, aerodynamic, freight, dynamicfreight, aerodynamicfreight
Attaching a sample index definition for the field “fieldName” with the travel-sample bucket here.
Blockquote
{
“type”: “fulltext-index”,
“name”: “IndexName”,
“sourceType”: “couchbase”,
“sourceName”: “travel-sample”,
“planParams”: {
“maxPartitionsPerPIndex”: 1024,
“indexPartitions”: 1
},
“params”: {
“doc_config”: {
“docid_prefix_delim”: “”,
“docid_regexp”: “”,
“mode”: “type_field”,
“type_field”: “type”
},
“mapping”: {
“analysis”: {
“analyzers”: {
“custom_analyser”: {
“token_filters”: [
“shingle_2_3”,
“to_lower”
],
“tokenizer”: “unicode”,
“type”: “custom”
}
},
“token_filters”: {
“shingle_2_3”: {
“filler”: “”,
“max”: 3,
“min”: 2,
“output_original”: true,
“separator”: “”,
“type”: “shingle”
}
}
},
“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”: {
“airline”: {
“dynamic”: false,
“enabled”: true,
“properties”: {
“fieldName”: {
“dynamic”: false,
“enabled”: true,
“fields”: [
{
“analyzer”: “custom_analyser”,
“docvalues”: true,
“include_in_all”: true,
“include_term_vectors”: true,
“index”: true,
“name”: “fieldName”,
“type”: “text”
}
]
}
}
}
}
},
“store”: {
“indexType”: “scorch”
}
},
“sourceParams”: {}
And a match query ought to work in this case.
Blockquote
{“query”: {“match”: “Aero Dynamic Freight”, “field”: “fieldName”}}’