因此,从this page的文档中,似乎我可以使用分析API从标记化器,令牌过滤器和字符过滤器构建自定义瞬态分析器,并根据我的示例文本对其进行测试 .
目标是我想看看synonym token filter是否满足我的需求,哪些术语被标记为同义词,哪些术语不被标记为同义词 .
但是,当我这样做
curl -XGET'localhost:9200 / _analyze?char_filters = html_strip&tokenizer = whitespace&token_filters = synonym'-d'man and male are same'
我得到了,而不是得到结果
{
"error": "ElasticsearchIllegalArgumentException[failed to find global token filter under [synonym]]",
"status": 400
}
我在这里做错了什么想法?
1 回答
目前无法使用ad-hoc同义词令牌过滤器,因为实现需要访问"to the tokenizer factories for the index."(请参阅elasticsearch Github issue . )不幸的是,此限制目前没有记录docs on using custom token filters on the _analyze endpoint
以下是使用重新打开索引的方法创建和更新同义词标记过滤器的一些示例命令:
(“我的手机”未被同义词列表捕获 . )
(“我的电话”由同义词列表翻译成“iphone” . )
(在一个不相关的说明中,我的zsh / YADR设置由于某种原因没有显示帖子响应主体,因此我通过
jq
进行管道传输 . )