【发布时间】:2015-01-08 17:39:19
【问题描述】:
我的问题很简单。假设我在索引中有一个类型映射,如下所示:
"mappings" : {
"post" : {
"analyzer" : "my_custom_analyzer",
"properties" : {
"body" : {
"type" : "string",
"store" : true
}
}
}
}
请注意,我将my_custom_analyzer 指定为该类型的分析器。当我在查询中没有指定分析器的情况下搜索正文字段时,I expect my_custom_analyzer to be used。但是,当我使用分析 API 查询字段时:
curl http://localhost:9200/myindex/_analyze?field=post.body&text=test
返回字符串的标准分析结果。当我指定分析器时,它可以工作:
curl http://localhost:9200/myindex/_analyze?analyzer=my_custom_analyzer&text=test
我的问题是:为什么我指定字段时,Analyze API 不使用默认类型分析器?
【问题讨论】:
标签: search elasticsearch analysis