Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
2.11
Describe the issue:
The only reference in the documentation about a copy_to
parameter is about an exception on the alias
field type.
However, the source code includes references to it, and it appears to work for some situations.
For instance, it does not seem to copy a text field to another one, but it seems to properly populate a completion
or search_as_you_type
field (see examples below).
It this parameter supported, and if so, on which scenarios?
Configuration:
Relevant Logs or Screenshots:
mapping
{
"properties": {
"__sayt": {
"type": "search_as_you_type"
},
"__suggest": {
"type": "completion"
},
"copy": {
"type": "text"
},
"title": {
"copy_to": [
"__sayt",
"__suggest",
"copy"
],
"analyzer": "french",
"type": "text"
}
}
}
index
POST /test/_doc/
{
"title": "An example"
}
test
GET /test/_search
{
"query": {
"bool": {
}
},
"suggest": {
"autocomplete": {
"prefix": "an",
"completion": {
"field": "__suggest"
}
}
}
}
---
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "test",
"_id": "6Soiwo4BcEb5YRiHfSwV",
"_score": 1,
"_source": {
"title": "An example"
}
}
]
},
"suggest": {
"autocomplete": [
{
"text": "an",
"offset": 0,
"length": 2,
"options": [
{
"text": "An example",
"_index": "test",
"_id": "6Soiwo4BcEb5YRiHfSwV",
"_score": 1,
"_source": {
"title": "An example"
}
}
]
}
]
}
}
GET /test/_search
{
"query": {
"multi_match": {
"query": "exa",
"type": "bool_prefix",
"fields": [
"__sayt",
"__sayt.2gram",
"__sayt._3gram"
]
}
},
"size": 3
}
---
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "test",
"_id": "6Soiwo4BcEb5YRiHfSwV",
"_score": 1,
"_source": {
"title": "An example"
}
}
]
}
}