试图弄清楚这个小例子的得分。我希望得到brenda eaton
的文档,但是我得到brenda fassie
的最佳结果。
PUT ngram
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings": {
"tweet" : {
"properties" : {
"text" : {
"type" : "text",
"analyzer": "my_analyzer"
}
}
}
}
}
PUT ngram/tweet/1
{
"text":"searched the blue sky during the summer"
}
PUT ngram/tweet/2
{
"text":"sdssded the trans hex during the sssss"
}
PUT ngram/tweet/3
{
"text":"searched the brenda eaton during the summer"
}
PUT ngram/tweet/4
{
"text":"sdssded the brenda fassie during the sssss"
}
GET ngram/_search
{
"query": {
"match" : {
"text" : {
"query" : "brenda eaton",
"max_expansions" : 10
}
}
}
}
答案 0 :(得分:1)
在填充索引的初始阶段,文档的相关性可能在很大程度上取决于其在分片中的分布。尝试使用一个主碎片和一个副本碎片创建索引,您将获得所需的结果。
您可以在以下来自Elasticsearch指南的文章中找到对此现象的很好的解释:Relevance is broken!