Allow autocomplete search on multiple fields using a wildcard path or by specifying multiple fields in the path
Currently, (unlike the text operator) the autocomplete operator does not accept a path which is an array of field names. Also, a wildcard path ("path": {"wildcard": "*"}) cannot be specified for an autocomplete query. Therefore, the only way to perform an autocomplete search on multiple fields is by using the compound operator.
This is a feature request to allow autocomplete search on multiple fields by using a wildcard path or by accepting an array of multiple fields in the path.
![](https://secure.gravatar.com/avatar/356224f6f402fc2aea8106b655c45951?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
AdminAmy (Admin, MongoDB) commented
As mentioned by Daniele, you can achieve this by using the compound operator, see example here: https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#search-across-multiple-fields
-
vamsikrishna Danda commented
is this issue cleared? I am still unable to pass the array of fields.
-
Anshuman commented
still waiting for the solution
-
Guillaume commented
Could we maybe get a little bit of visibility on that? Are we looking at a few weeks? a few months? one more year?
Any vague info would help us out there planning our developments.Thanks.
-
Geoff commented
Hi there. Could we at least get an update as it is nearly a year since work was going to begin on this. Thanks in advance.
-
Guillaume commented
Any update on that? It's still quite blocking not to be able to do a simple autocomplete search on an array of objects.
Thanks, please keep us posted.
-
Joseph commented
Also would love this. I can work around for now, but would be a nice feature. Any updates?
Would also be great if this limitation could be mentioned in the docs. If it is already, I didn't see it. Thanks.
-
Luke commented
Any update on this issue? I see the last comment was about 6 months ago. Running into this one now.
-
Daniele commented
I ran a test that worked:
{
"mappings": {
"dynamic": false,
"fields": {
"category": {
"foldDiacritics": true,
"maxGrams": 15,
"minGrams": 2,
"tokenization": "nGram",
"type": "autocomplete"
},
"wisdom": {
"foldDiacritics": true,
"maxGrams": 15,
"minGrams": 2,
"tokenization": "nGram",
"type": "autocomplete"
}
}
}
}Search with:
db.examplecoll.aggregate([
{
$search: {
"compound": {
"should": [
{
"autocomplete": {
"query": "conn sur",
"path": "category"
}
},
{
"autocomplete": {
"query": "conn sur",
"path": "wisdom"
}
}],
"minimumShouldMatch": 1
}
}
}
]) -
Petchimutha commented
This feature will be useful. We have lot of use case for multiple fields and partial search with case insensitive.