elasticsearch ElasticSearch/Elastica:搜索准确的术语,包括;及;或者其他的话,elasticsearch,stop-words,elastica,elasticsearch,Stop Words,Elastica" /> elasticsearch ElasticSearch/Elastica:搜索准确的术语,包括;及;或者其他的话,elasticsearch,stop-words,elastica,elasticsearch,Stop Words,Elastica" />

elasticsearch ElasticSearch/Elastica:搜索准确的术语,包括;及;或者其他的话

elasticsearch ElasticSearch/Elastica:搜索准确的术语,包括;及;或者其他的话,elasticsearch,stop-words,elastica,elasticsearch,Stop Words,Elastica,我试图让ES QueryString匹配其中包含“and”的搜索词,但到目前为止我尝试的一切(尝试不同的分析器、标记器、过滤器)都没有成功。就MySQL而言,我想要的是: WHERE field LIKE '%abbot and costello%' 我尝试过各种配置,这就是我目前使用的配置(略微改进,它匹配了“abbot”(带尾随空格),但仍然没有匹配其中的“and”: 以下是我的测试用例字段值: Abbott and Costello - Funniest Routines, Vol.

我试图让ES QueryString匹配其中包含“and”的搜索词,但到目前为止我尝试的一切(尝试不同的分析器、标记器、过滤器)都没有成功。就MySQL而言,我想要的是:

WHERE field LIKE '%abbot and costello%'
我尝试过各种配置,这就是我目前使用的配置(略微改进,它匹配了“abbot”(带尾随空格),但仍然没有匹配其中的“and”:

以下是我的测试用例字段值:

Abbott and Costello - Funniest Routines, Vol. 
尝试各种各样的分析器,我似乎无法让它匹配任何包含“和”的东西

结果:

searching [abbot] 
 @       searchAnalyzer          total results: 1
 @       standard                total results: 1
 @       simple                  total results: 1
 @       whitespace              total results: 1
 @       keyword                 total results: 1


searching [abbot ] 
 @       searchAnalyzer          total results: 1
 @       standard                total results: 1
 @       simple                  total results: 1
 @       whitespace              total results: 1
 @       keyword                 total results: 1


searching [abbot and c] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot and cost] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot and costello] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot costello] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0

您在查询中有输入错误(雅培中缺少第二个t)。您也不需要通过nGram运行搜索。搜索标记器可以是关键字,它仍然适用于少于35个字符的短语。而且,顺便说一句,edgeNGram只提供尾随通配符。对于前导通配符和尾随通配符,您需要使用nGram筛选器。

我知道这是一个简单的答案,但感谢您接受此测试让我指出问题所在,这让我非常伤心..检查了所有内容,但最明显的是:(
searching [abbot] 
 @       searchAnalyzer          total results: 1
 @       standard                total results: 1
 @       simple                  total results: 1
 @       whitespace              total results: 1
 @       keyword                 total results: 1


searching [abbot ] 
 @       searchAnalyzer          total results: 1
 @       standard                total results: 1
 @       simple                  total results: 1
 @       whitespace              total results: 1
 @       keyword                 total results: 1


searching [abbot and c] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot and cost] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot and costello] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0


searching [abbot costello] 
     searchAnalyzer          total results: 0
     standard                total results: 0
     simple                  total results: 0
     whitespace              total results: 0
     keyword                 total results: 0