Hi @Nikita_Prokopev and thank you for sharing the above query and sample documents.
Here is what I tried based on the sample document shared, the lucene.whitespace analyzer used in my example divides text into searchable terms wherever it finds a whitespace character. It leaves all terms in their original case. You may need to adjust your index accordingly & test thoroughly to verify if the following suits your use cases.
Here, is how my index definition looks like:
Index Definition:
{
"analyzer": "lucene.whitespace",
"searchAnalyzer": "lucene.whitespace",
"mappings": {
"dynamic": false,
"fields": {
"name": [
{
"analyzer": "lucene.whitespace",
"type": "string"
},
{
"analyzer": "lucene.whitespace",
"type": "autocomplete"
}
],
"sku": [
{
"analyzer": "lucene.whitespace",
"type": "string"
},
{
"analyzer": "lucene.whitespace",
"type": "autocomplete"
}
]
}
}
}
And the following query returns the required documents:
[
{
'$search': {
'index': 'default',
'compound': {
'should': [
{
'autocomplete': {
'query': '29 1’ 1/',
'path': 'name'
}
}, {
'autocomplete': {
'query': '29 1’ 1/',
'path': 'sku'
}
}
]
}
}
}
]
Let us know if you have any further questions .
Best Regards
Aasawari