Atlas Search Autocomplete on an array of object

Hi

I have an array of objects like

services: [

{
  name: "repair tire"
},
{
   name: "oil change"
}

]

I set a MongoDB atlas full text search with autocomplete on “services.name” but when i search using autocomplete it doest not show anything.

3 Likes

Did you find a solution for this yet? I am experiencing the same kind of problem…

Hello!

Thanks so much for your questions about Atlas Search. Can you please share the sample code of your search query and your index, so I can have a deeper look?

Karen

Hello Karen, we are facing similar kind of issue. Please find details below:

Sample collection data:

{ "name" : "Phani", "phones" : [ { "phoneNumber" : "123456789" } ] }
{ "name" : "Yuva", "phones" : [ { "phoneNumber" : "987654321" } ] }

Autocomplete search index on phoneNumber:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "phones": {
        "fields": {
          "phoneNumber": {
            "tokenization": "edgeGram",
            "type": "autocomplete"
          }
        },
        "type": "document"
      }
    }
  }
}

Query used:

{ $search: {“autocomplete”: {“query”: “1234”,“path”: “phones.phoneNumber”}} }

=> returns no result

I’m facing the same issue. It works on a simple nested document, but not for an array of nested documents. It works with “text” instead of “autocomplete” but that requires the exact string which is not really possible.

Hello everybody, same issue here :frowning: Somebody find a solution ? Please help, because this is very impactful. Thanks in advance.

Please Karen, help us with this topic :pray:

Hello, everyone. Thank you so much for the code and index definitions. You are correct that this does not currently work, but this is a particular use case we are actively working on right now. @Shadoweb_EB, you could include a fuzzy object into the text- but you would have to get close to the end of the string for this to work.
"fuzzy": { "maxEdits": 2 }
So this is not exactly what you need.
Hopefully, we will have a resolution soon.

1 Like

How much time until it will be supported?

1 Like

Hello Karen, Thanks for your answer. Do you think it’s going to take a long time ? Do you have approximatively an idea on how much time ? Many of us are waiting for a solution to this problem. Also, could you posted here once a solution has been found ? Thank you in advance for your help.

Hello. It should be done this quarter. Please vote on the issue on feedback.mongodb.com, you should be notified when it is worked out. Allow autocomplete search on multiple fields using a wildcard path or by specifying multiple fields in the path – MongoDB Feedback Engine

Karen

3 Likes