Elastic phrase suggester

Query:

POST merchants_phrase_suggester_29032023/_search
{
"suggest": {
"text" : "amazn,walmart",
"simple_phrase" : {
"phrase" : {
"field" : "mrch_nm.trigram",
"size" : 1,
"confidence":0,
"gram_size":3,
"max_errors":3,
"direct_generator" : [ {
"field" : "mrch_nm.trigram",
"suggest_mode" : "always"
} ],
"collate": {
"query": {
"source" : {
"match": {
"{{field_name}}" : "{{suggestion}}"
}
}
},
"params": {"field_name" : "mrch_nm"},
"prune": true
}
}
}
}
}

I have to search in above index for 2 records "amazon" and "walmart" and these records are stored corresponding to field "mrch_nm".

So, basically ,I want muti value search for single field. I have tried above query but getting below result :slight_smile:
"suggest" : {
"simple_phrase" : [
{
"text" : "amazn,walmart",
"offset" : 0,
"length" : 13,
"options" : [
{
"text" : "amazon walmart",
"score" : 5.6008284E-4,
"collate_match" : true
}
]
}
]
}
}

its coming together and without comma separated..so it unclear what is suggestion for "amazon" and what is for "walmart" . There is no separation.

Can anyone help in search for multi value for single field.

P.S: Amazon and walmart are 2 different records in index.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.