elasticsearch 弹性搜索N-gram未返回预期结果,elasticsearch,kibana,elasticsearch,Kibana" /> elasticsearch 弹性搜索N-gram未返回预期结果,elasticsearch,kibana,elasticsearch,Kibana" />

elasticsearch 弹性搜索N-gram未返回预期结果

elasticsearch 弹性搜索N-gram未返回预期结果,elasticsearch,kibana,elasticsearch,Kibana,试图找出这个微不足道的例子的分数。我希望得到brenda eaton的文档,但我得到的是brenda fassie的最佳结果 PUT ngram { "settings": { "analysis": { "analyzer": { "my_analyzer": { "tokenizer": "my_tokenizer" } }, "tokenizer": { "my_tokeni

试图找出这个微不足道的例子的分数。我希望得到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
            }
        }
    }
}

在填充索引的初始阶段,文档的相关性可能很大程度上取决于它们在碎片中的分布。尝试使用一个主分片和一个副本分片创建索引,您将获得所需的结果


您可以在Elasticsearch guide的以下文章中找到对这种现象的一个很好的解释:

这太疯狂了,很高兴知道。告诉我,如果我搜索“brenda e”,并且考虑到我用一个主索引和一个索引更新了我的索引,那么我会再次得到错误结果的原因是什么replica@R4nc1d这次没什么特别的。分数之间的微小差异是由字段长度造成的(字段越短,分数越高)。