Skip to content

Semantic fields not possible as dynamic mapping and/or as internal mapping field #3950

Open
@reuschling

Description

@reuschling

I tried to declare a semantic field inside my dynamic mappings and failed:

"dynamic_templates": [
{
	"semantic": {
		"match": "semantic_*",
		"mapping": {
			"type": "semantic",
			"model_id": "4j4iwZcB7dKCiuIqGvlV"
		}
	}
},
{
	"textwithNgramSemantic": {
		"match": "tnsem_*",
		"mapping": {
			"type": "text",
			"analyzer": "standardWithStopwords",
			"fields": {
				"ngram": {
					"type": "text",
					"analyzer": "4gram"
				},
				"semantic": {
					"type": "semantic",
					"model_id": "4j4iwZcB7dKCiuIqGvlV"
				}
			}
		}
	}
}
]

No one of these get a _semantic_info mapping entry, also inserting documents and searching them with neural search is not possible.

I then tried it without the dynamic pattern and declared two fields directly:

"properties": {
	"semanticBody": {
		"type": "semantic",
		"model_id": "4j4iwZcB7dKCiuIqGvlV"
	},
	"semanticNgramBody": {
		"type": "text",
		"analyzer": "standardWithStopwords",
		"fields": {
			"ngram": {
				"type": "text",
				"analyzer": "4gram"
			},
			"semantic": {
				"type": "semantic",
				"model_id": "4j4iwZcB7dKCiuIqGvlV"
			}
		}
	}
}

Only the semanticBody that directly corresponds to the semantic field documentation gets a _semantic_info mapping entry.

So there are 3 regular OpenSearch field declarations where semantic fields are not possible currently:

  1. Declaration as additional field inside a regular "mappings" => "properties" setting
  2. Declaration without internal/additional field as dynamic mapping under "mappings" => "dynamic_templates"
  3. Declaration as additional field inside the dynamic templates (the combination of 1. and 2.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

On-deck

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions