Create Search Vector Index for a Json field

I’m trying to create a search vector index to point to an embedded data inside a field document type Json but when i try to add the code for creating it on Compass i cant manage to get the format right, im trying to do something like this,

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "specs": {
        "type": "document",
        "fields": {
          "groups": {
            "type": "array",
            "fields": {
              "obligations": {
                "type": "array",
                "fields": {
                  "embedding": {
                    "type": "vector",
                    "numDimensions": 1536,
                    "similarity": "cosine"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

so the field is called specs then inside is the json where inside that json the next field is groups and inside that group either i can embed the data there or inside obligations (i can modify that and adapt it)

but i always get a failed status or says the fields are missing or other generic error.

Hi @Andres_N_A3 , I took a look at the json above for the search vector index and it is valid json. Would you provide a sample document to help make the issue clearer?

Arrays of embeddings are currently not supported. One embedding per document for the specified field.

1 Like