Here is a sample doc I am trying to search:
{
"_id": {
"$oid": "6436a6e365bb0bf723a17a21"
},
"name": "Indian Institute of Nursing ",
"city": "",
"memberCount": 0,
"state": "Karnataka"
}
My current index mapping:
{
"mappings": {
"dynamic": false,
"fields": {
"name": [
{
"foldDiacritics": true,
"maxGrams": 30,
"minGrams": 1,
"tokenization": "edgeGram",
"type": "autocomplete"
},
{
"type": "string"
}
]
}
}
}
My aggregation for search:
{
index: "institutesEdge",
returnStoredSource: true,
compound: {
must: [
{
autocomplete: {
path: "name",
query: "indian institute of",
tokenOrder: "sequential",
},
},
],
},
}
The above runs correctly and show result, but if I change the text from indian institute of
to indian institute of nur
or indian institute of
(space after of), it says no result.
This happens for much smaller search terms as well, it doesnt show any result after third space is entered but works perfectly before that.
I have tried using ngram as well, same issue with that too.
Please suggest if I am doing something wrong?