Using semantic field type results in invalid space_type error

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): Latest on Docker

Describe the issue: I am trying to use new index field type “semantic” in a index as follows:

PUT /test2
{
“settings”: {
“index”: {
“knn”: “true”
}
},
“mappings”: {
“properties”: {
“submissionCombined”: {
“type”: “semantic”,
“model_id”: “5ZOVKpkBwr2LEJfgZHiJ”,
“search_model_id”: “5ZOVKpkBwr2LEJfgZHiJ”,
“semantic_info_field_name”: “submissionCombined_Embedding2”,
“chunking”: true
}
}
}
}

Here model is “huggingface/sentence-transformers/paraphrase-mpnet-base-v2” which uses space_type = cosine and a OS local model.

When I try to create index, error is

    "type": "mapper_parsing_exception",
    "reason": "Invalid space_type: cosine"

Is there a bug or semantic does not support models w/ cosine space type?

Thanks

Configuration:

Relevant Logs or Screenshots:

I think we didn’t use the right value to set our pre-trained model config. It should be “cosinesimil“ rather than “cosine“. To unblock yourself you can use getModel API to pull the model config and then modify the space_type and then use updateModel API to update it. Then you should be able to create the index with the model.

We will fix the config for the model.

"additional_config": {
			"space_type": "cosine" -> "cosinesimil"
		}
1 Like

I will try this. In the mean time, should an be issue created in github to fix this problem?

1 Like

I have already created an issue and it should be fixed soon.

1 Like

Thank you.