Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Elasticsearch返回意外结果_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch Elasticsearch返回意外结果,elasticsearch,elasticsearch" /> elasticsearch Elasticsearch返回意外结果,elasticsearch,elasticsearch" />

elasticsearch Elasticsearch返回意外结果

elasticsearch Elasticsearch返回意外结果,elasticsearch,elasticsearch,我使用了以下映射: 我已将english analyzer修改为使用ngram analyzer,如下所示,以便我能够在以下情况下进行搜索: 1] 部分搜索和特殊字符搜索 2] 利用语言分析器 { "settings": { "analysis": { "analyzer": { "english_ngram": { "type": "custom",

我使用了以下映射: 我已将english analyzer修改为使用ngram analyzer,如下所示,以便我能够在以下情况下进行搜索: 1] 部分搜索和特殊字符搜索 2] 利用语言分析器

{
    "settings": {
        "analysis": {
            "analyzer": {
                "english_ngram": {
                    "type": "custom",
                    "filter": [
                        "english_possessive_stemmer",
                        "lowercase",
                        "english_stop",
                        "english_stemmer",
                        "ngram_filter"
                    ],
                    "tokenizer": "whitespace"
                }
            },
            "filter": {
                "english_stop": {
                    "type": "stop"
                },
                "english_stemmer": {
                    "type": "stemmer",
                    "language": "english"
                },
                "english_possessive_stemmer": {
                    "type": "stemmer",
                    "language": "possessive_english"
                },
                "ngram_filter": {
                    "type": "edge_ngram",
                    "min_gram": 1,
                    "max_gram": 25
                }
            }
        }
    },
    "mappings": {
    "movie": {
      "properties": {
        "title": {
          "type": "string",
          "fields": {
            "en": {
              "type":     "string",
              "analyzer": "english_ngram"
            }
          }
        }
      }
    }
  }
}
将我的数据编入索引,如下所示:

   PUT http://localhost:9200/movies/movie/1
    {
        "title" : "$peci@l movie"
    }
{
    "query": {
        "multi_match": {
            "query":    "$peci#44 m11ov",
            "fields": ["title.en"],
            "operator":"and",
            "type":     "most_fields",
            "minimum_should_match": "75%"
        }
    }
}
查询如下:

   PUT http://localhost:9200/movies/movie/1
    {
        "title" : "$peci@l movie"
    }
{
    "query": {
        "multi_match": {
            "query":    "$peci#44 m11ov",
            "fields": ["title.en"],
            "operator":"and",
            "type":     "most_fields",
            "minimum_should_match": "75%"
        }
    }
}
在查询中,我正在寻找“$peci#44 m11ov”字符串,理想情况下,我不应该得到这个字符串的结果。
这里有什么问题吗?

这是ngram标记化的结果。当您标记字符串
$peci@lmovie
您的分析器生成标记,如
$
$p
$pe
,等等。您的查询也会生成大多数标记。尽管这些比赛的分数比完整的比赛要低。如果排除这些假阳性匹配非常重要,您可以尝试使用
minu score
选项设置阈值