对不起,我的英文))
告诉我如何在nGram字段上将分数模式从“总和”更改为“最高”?
由于相加,elasticsearch给出的结果不适合我。我需要获取最大值,而不是金额。
信誉不允许附加图像。请看一下图像,它是什么样的“和”: https://discourse-cdn-sjc1.com/elastic/uploads/default/original/3X/6/5/65d113280a484faa9af3398ed73343cdb08c4075.png
{
"mappings": {
"addresses": {
"properties": {
...........................
"tokensName": {
"type": "text",
"analyzer": "tokens",
"similarity": "scripted_tfidf"
}
...........................
}
}
},
"settings": {
"similarity": {
"scripted_tfidf": {
"type": "scripted",
"script": {
"source": "double tf = 1.0; double idf = 1.0; double norm = 1.0; return query.boost * tf * idf * norm * weight;"
}
}
},
"analysis": {
"filter": {
"shingle": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"tokens": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"shingle"
]
}
}
}
}
}
{
...........................
"tokensName": "ирпень точный университет"
...........................
}
{
"size": 5,
"query": {
"match": {
"tokensName": {
"query": "ирпень фаворит ун точно",
"analyzer": "standard",
"fuzziness": "AUTO"
}
}
},
"explain": true
}