我正在尝试将弹性搜索索引配置为使用keyword
分析器进行分析的默认索引策略,然后在某些字段上覆盖它,以允许对它们进行自由文本分析。如此有效地选择加入自由文本分析,我在映射中明确指定分析哪些字段以进行自由文本匹配。我的映射定义如下所示:
PUT test_index
{
"mappings":{
"test_type":{
"index_analyzer":"keyword",
"search_analyzer":"standard",
"properties":{
"standard":{
"type":"string",
"index_analyzer":"standard"
},
"keyword":{
"type":"string"
}
}
}
}
}
所以standard
应该是一个分析的字段,并且keyword
应该是完全匹配的。但是,当我使用以下命令插入一些示例数据时:
POST test_index/test_type
{
"standard":"a dog in a rug",
"keyword":"sheepdog"
}
我没有得到与以下查询的任何匹配:
GET test_index/test_type/_search?q=dog
但是我确实得到了比赛:
GET test_index/test_type/_search?q=*dog*
这让我觉得这个standard
领域没有被分析。有谁知道我做错了什么?