Hi, I'm trying out the Phrase Suggester and wondering if there is a way to make it always return whole fields? For example, when I search noble
I want the suggestion to be nobel prize
rather than just the term nobel
.
My search query looks like this:
{
"query": {
"match": {
"title": "this"
}
},
"suggest": {
"text": "that",
"simple_phrase": {
"phrase": {
"field": "title.trigram",
"size": 1,
"gram_size": 3,
"direct_generator": [
{
"field": "title.trigram",
"suggest_mode": "always"
}
],
"highlight": {
"pre_tag": "<em>",
"post_tag": "</em>"
}
}
}
}
}
And the index is set up like this:
"settings": {
"index": {
"number_of_shards": 1,
"analysis": {
"analyzer": {
"trigram": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase","shingle"]
}
},
"filter": {
"shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
}
}
}
}
},
"mappings": {
"properties": {
"title": {
"type": "text",
"fields": {
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
}
}
}
}
I'd really appreciate any suggestions here! Thanks