Hi all!
I found the issue with Completion Suggester API if I use it for a field which have list of values. For example I have the next document:
PUT /example
{
"mappings": {
"_doc": {
"properties": {
"product": {
"type": "keyword",
"store": true,
"copy_to": [
"product_suggest"
]
},
"product_suggest": {
"type": "completion",
"analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 32
}
}
}
}
}
and data are:
PUT /example/_doc/1
{
"product": [
"product-3",
"product-2",
"product-1"
]
}
When I execute the query:
POST /example/_search
{
"_source": "product",
"suggest": {
"suggestions" : {
"prefix" : "product-",
"completion" : {
"field" : "product_suggest",
"skip_duplicates": true,
"size": 10
}
}
}
}
I expect to get 3 values - product-1
, product-2
and product-3
but I get product-1
only. Response of the query below:
"suggest": {
"suggestions": [
{
"text": "product-",
"offset": 0,
"length": 8,
"options": [
{
"text": "product-1",
"_index": "example",
"_type": "_doc",
"_id": "1",
"_score": 1.0,
"_source": {
"product": [
"product-3",
"product-2",
"product-1"
]
}
}
]
}
]
}
Any ideas how to solve it?
Thanks in advance,
Vova