I am trying to search strings in a few fields using wildcard and a custom analyzer (mentioned below) and I am not getting any response for the query ‘Checking all*’ and I get no results.
The query:
db.getCollection('ruleinventories').aggregate([
{
$search:{
"index":"searchAll",
"wildcard":{
"query":"*Checking all*",
"path":{
"wildcard":"*"
},
"allowAnalyzedField":true
},
"highlight":{
"path":{
"wildcard":"*"
}
}
}
},
{
$project:{
'ruleType':1,
'applicationId':1,
'applicationName':1,
'name':1,
'eventTriggerName':1,
'description':1
}},
]
)
The index:
{
"analyzer": "lucene.standard",
"searchAnalyzer": "keywordregex",
"mappings": {
"dynamic": false,
"fields": {
"applicationId": {
"representation": "int64",
"type": "number"
},
"applicationName": {
"type": "string"
},
"collectionName": {
"type": "string"
},
"description": {
"type": "string"
},
"documentGroup": {
"type": "string"
},
"eventTriggerName": {
"type": "string"
},
"name": {
"type": "string"
},
"ruleBuilder": [
{
"dynamic": true,
"type": "document"
},
{
"type": "string"
}
],
"ruleNumber": {
"type": "string"
},
"ruleType": {
"type": "string"
}
}
},
"analyzers": [
{
"charFilters": [],
"name": "keywordregex",
"tokenFilters": [
{
"type": "lowercase"
}
],
"tokenizer": {
"type": "keyword"
}
}
]
}
The result I am expecting: