2
我使用ElasticSearch和我有以下指數映射:ElasticSearch - 詞組SUGGESTOR
post /my_index
{
"mappings": {
"medical_terms": {
"properties": {
"terms": {
"type": "string"
}
}
}
}
}
PUT my_index/medical_terms/1
{
"term": "Paracetamol tablets"
}
POST /my_index/_search?search_type=count
{
"suggest" : {
"text" : "paracetmo tabelts",
"simple_phrase" : {
"phrase" : {
"field" : "term",
"size" : 1,
"real_word_error_likelihood" : 0.95,
"max_errors" : 0.5,
"gram_size" : 2,
"highlight": {
"pre_tag": "<em>",
"post_tag": "</em>"
}
}
}
}
}
我如何獲得這句話建議器在它返回的時刻返回「撲熱息痛片」:
"suggest": {
"simple_phrase": [
{
"text": "paracetmo tabelts",
"offset": 0,
"length": 17,
"options": [
{
"text": "paracetmo tablets",
"highlighted": "paracetmo <em>tablets</em>",
"score": 0.24901225
}
]
}
]
我需要使用自定義分析器和字典嗎?