在 Mapping 里面,将 dynamic 参数设置成 strict 可以拒绝索引包含未知字段的文档。 此条 Tips 由 medcl 贡献。

同义词的重复问题

Elasticsearch | 作者 zjthree | 发布于2016年09月08日 | 阅读数:4178

我设置了同义词词条:米其林,michelin
查看分词的结果:
[url=http://192.168.5.84:9200/b_item_192_168_5_122/_analyze?text=%E7%B1%B3%E5%85%B6%E6%9E%97%20michelin&analyzer=ik_smart_syno]http://192.168.5.84:9200/b_ite ... _syno[/url]
现在的分词结果是
{
tokens: [
{
token: "米其林",
start_offset: 0,
end_offset: 3,
type: "CN_WORD",
position: 0
},
{
token: "michelin",
start_offset: 0,
end_offset: 3,
type: "SYNONYM",
position: 0
},
{
token: "michelin",
start_offset: 4,
end_offset: 12,
type: "ENGLISH",
position: 1
},
{
token: "米其林",
start_offset: 4,
end_offset: 12,
type: "SYNONYM",
position: 1
}
]
}
这样的话就出现了重复 这个问题能解决不?
已邀请:

medcl - 今晚打老虎。

赞同来自:

这个是正常啊,每个词都返回了各自的原词和同义词,你可以再加一个  unique filter 进行过滤

要回复问题请先登录注册