Elasticsearch默认提供的分词器,会把每一个汉字分开,而不是我们想要的依据关键词来分词。比如:
curl -XPOST "http://localhost:9200/userinfo/_analyze?analyzer=standard&pretty=true&text=我是中国人"我们会得到这种结果:
{
tokens: [
{
token: text
start_offset: 2
end_offset: 6
type:
position: 1
}
{
token: 我
start_offset: 9
end_offset: 10
type:
position: 2
}
{
token: 是
start_offset: 10
end_offset: 11
type:
position: 3
}
{
token: 中
start_offset: 11
end_offset: 12
type:
position: 4
}
{
token: 国
start_offset: 12
end_offset: 13
type:
position: 5
}
{
t