用了Elasticsearch,一口气上5T

一个索引中如何同时使用IK、pingyin、stconvert

Elasticsearch | 作者 guoqk0912 | 发布于2016年03月04日 | 阅读数:5181

希望在搜索时,可以自动通过拼音、或者繁体找到搜索结果,我目前只用到IK分词,希望大神给改一下
$params = array(
'index' => 'heying',
'body' => array(
'mappings' => array(
'yiqi' => array(
'_all' => array(
'analyzer' => 'ik_smart',
'search_analyzer' => 'ik_smart',
'term_vector' => 'no',
'store' => 'no'
),
'properties' => array(
'article_id' => array(
'type' => 'integer',
'store' => 'yes'
),
'catid' => array(
'type' => 'integer',
'store' => 'yes'
),
'title' => array(
'type' => 'string',
'store' => 'no',
'term_vector' => 'with_positions_offsets',
'analyzer' => 'ik_smart',
'search_analyzer' => 'ik_smart',
'include_in_all' => 'yes',
'boost' => 10
),
'url' => array(
'type' => 'string',
'store' => 'no',
),
'thumb' => array(
'type' => 'string',
'store' => 'no',
),
'brand' => array(
'type' => 'string',
'store' => 'yes',
),
'model_number' => array(
'type' => 'string',
'store' => 'yes'
),
'attribute' => array(
'type' => 'string',
'store' => 'no',
'term_vector' => 'with_positions_offsets',
'analyzer' => 'ik_smart',
'search_analyzer' => 'ik_smart',
'include_in_all' => 'yes',
'boost' => 8
),
'content' => array(
'type' => 'string',
'store' => 'no',
'term_vector' => 'with_positions_offsets',
'analyzer' => 'ik_smart',
'search_analyzer' => 'ik_smart',
'include_in_all' => 'yes',
'boost' => 6
)
)
)
)
)
);
已邀请:

medcl - 今晚打老虎。

赞同来自:

自定义一个analyzer,组合ik和stconvert(char-filters使用stconvert,tokenizer使用ik),pinyin比较特殊,建议单独一个字段
 

要回复问题请先登录注册