Easysearch、Elasticsearch 还是 Opensearch,是个问题

IK分词后对搜索英文、数字的影响,搜索不出来?

Elasticsearch | 作者 xiaoyao | 发布于2016年10月13日 | 阅读数:15502

1.以下是索引建立时的mapping
POST /ikanalyse
{   
    "settings": {},
    "mappings": {
        "fulltext": {              
            "_all": {             
                "analyzer": "ik_max_word",             
                "search_analyzer": "ik_max_word",
                "term_vector": "no",             
                "store": "false"         
            },         
            "properties": {             
                "content": {                 
                    "type": "string",                 
                    "store": "no",                 
                    "term_vector": "with_positions_offsets",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word",
                    "include_in_all": "true",
                    "boost": 8             
                }
            }     
        }
}
2 添加数据
POST /ikanalyse/fulltext/4
{"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船abcsader我来了1234.92,3你好,Ok"}
3 查询语句
POST /ikanalyse/fulltext/_search?pretty
{
    "query": {
        "bool": {"must": [
           {
               "term": {
             "content":"1234"
           }}
        ]}
    }
}
但是查询无结果,我想达到的效果是搜索1234,或者abc,或者92都能将此文档搜索出来。请问大神们,可有办法实现啊,还请指教。谢谢
已邀请:

martindu - 搜披露创始人

赞同来自:

我测了一下,abcsader、1234.92是被ik_max_word作为完整的term分出来了,所以你搜abc或者1234是搜不到的。如果这个需求特别重要,可以冗余一下这个字段然后用nGram Analyzer分词,然后用MatchPhrase构造查询。

要回复问题请先登录注册