Lab: Group Search Results by Using Facets

atlas clusters search indexes create --clusterName myAtlasClusterEDU -f /app/search_index.json

after several attempts,
i am getting following error : Error: json: cannot unmarshal array into Go struct field FTSMappings.mappings.fields of type map[string]interface {}

Lab: Group Search Results by Using Facets

3 Likes

same issue with that mongodb univeristy lab. Hope they solve it soon

2 Likes

Ok, so this is really annoying. I can create the index using the Atlas GUI. The index even becomes active, therefore it seems that there are no issues with the syntax or the config. However, within the terminal, when I try to run this command in the CLI/terminal after creating the index in the GUI

atlas clusters search indexes list --clusterName myAtlasClusterEDU --db sample_supplies --collection sales

I get the same

Error: json: cannot unmarshal array into Go struct field FTSMappings.mappings.fields of type map[string]interface {}

Therefore, since the command above is used to view the indexes and even that does not run, it seems that the issue is with the settings in the terminal. It appears that the program is struggling with the parsing the arrays in “purchaseMethod” and “storeLocation”.

To create the index using the Atlas GUI, I used the following settings, along with selecting the ‘sample_supplies’ database and the ‘sales’ collection, along with using the same index name

{
  "analyzer": "lucene.standard",
  "searchAnalyzer": "lucene.standard",
  "mappings": {
    "dynamic": true,
    "fields": {
      "purchaseMethod": [
        {
          "dynamic": true,
          "type": "document"
        },
        {
          "type": "string"
        }
      ],
      "storeLocation": [
        {
          "dynamic": true,
          "type": "document"
        },
        {
          "type": "stringFacet"
        }
      ]
    }
  }
}

Same issue here… it’s still failing at this point… :frowning:

Hey, i am also having same issue, any fix?

Hey everyone,

Thanks for reaching out to the MongoDB Community forums :sparkles:

Please allow me some time to get it checked and will keep you all updated.

Best,
Kushagra

Hey :wave: @Mohan_Selvam/@BhEaN/@Areeb_A/@Giorgio_Laura/@Aakash_Mahawar,

Thanks for highlighting it. There has been an identified issue with the Atlas CLI regarding JSON parsing, and that has been successfully resolved. You should now be able to complete your labs without any issues.

If you encounter any problems or have any questions, please feel free to reach out to us.

Best regards,
Kushagra

thanks @Kushagra_Kesav

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.