分析接口
/_index_test/_analyze
{
"analyzer": "ik_syno_smart",
"text": "jingji"
}
返回
{
"tokens": [
{
"token": "经济",
"start_offset": 0,
"end_offset": 6,
"type": "SYNONYM",
"position": 0
}
]
}
搜索时指定 analyzer 为同义词时无法查询到结果
/_index_test/_search
{
"query": {
"bool": {
"filter":{"term":{"status":1}},
"should": [
{ "multi_match":
{
"query":"jingji",
"analyzer":"standard",
"type":"best_fields",
"fields":["article_title^999991", "article_kw^9999", "article_des", "article_intro", "article_tag^9999", "article_cont"]
}
}
]
}
},
"min_score":1,
"size":2
}
但是,如果不指定 analyzer 或者 指定为 standard ,搜索词 为 经济 ,就可以查询到相关的内容
求大佬,救救这个菜鸡
/_index_test/_analyze
{
"analyzer": "ik_syno_smart",
"text": "jingji"
}
返回
{
"tokens": [
{
"token": "经济",
"start_offset": 0,
"end_offset": 6,
"type": "SYNONYM",
"position": 0
}
]
}
搜索时指定 analyzer 为同义词时无法查询到结果
/_index_test/_search
{
"query": {
"bool": {
"filter":{"term":{"status":1}},
"should": [
{ "multi_match":
{
"query":"jingji",
"analyzer":"standard",
"type":"best_fields",
"fields":["article_title^999991", "article_kw^9999", "article_des", "article_intro", "article_tag^9999", "article_cont"]
}
}
]
}
},
"min_score":1,
"size":2
}
但是,如果不指定 analyzer 或者 指定为 standard ,搜索词 为 经济 ,就可以查询到相关的内容
求大佬,救救这个菜鸡
1 个回复
medcl - 今晚打老虎。
赞同来自: