qq_max 和 qq_smart 有什么区别?PUT /index{"mappings": {"_doc": {"properties": {"content": {"type": "text","analyzer": "qq_max","search_analyzer": "qq_smart"}}}}}
index的索引,类型为_doc(ES 7及以上版本需要在创建索引时加入?include_type_name=true才能支持类型)。包含了一个content属性,类型为text,并使用了qq_max和qq_smart分析器。执行成功后,将返回如下结果。{"acknowledged": true,"shards_acknowledged": true,"index": "index"}
POST /index/_doc/1{"content": "我从微信上下载了王者荣耀"}POST /index/_doc/2{"content": "住建部:9月底前完成名镇名村景观资源登记"}POST /index/_doc/3{"content": "中国气象台最新天气预报"}POST /index/_doc/4{"content": "我家住在中国古建筑保护协会附近"}
qq_max分析器对文档进行分析。GET index/_search{"query" : { "match" : { "content" : "中国" }},"highlight" : {"pre_tags" : ["<tag1>", "<tag2>"],"post_tags" : ["</tag1>", "</tag2>"],"fields" : {"content": {}}}}
_doc类型的文档中,使用qq_smart分析器,搜索content字段中包含中国的文档。执行成功后,返回如下结果。{"took" : 108,"timed_out" : false,"_shards" : {"total" : 1,"successful" : 1,"skipped" : 0,"failed" : 0},"hits" : {"total" : {"value" : 2,"relation" : "eq"},"max_score" : 0.7199211,"hits" : [{"_index" : "index","_type" : "_doc","_id" : "4","_score" : 0.7199211,"_source" : {"content" : "我家住在中国古建筑保护协会附近"},"highlight" : {"content" : ["我家住在<tag1>中国</tag1>古建筑保护协会附近"]}},{"_index" : "index","_type" : "_doc","_id" : "3","_score" : 0.6235748,"_source" : {"content" : "中国气象台最新天气预报"},"highlight" : {"content" : ["<tag1>中国</tag1>气象台最新天气预报"]}}]}}


.dic。GET _analyze{"text": "我家住在中国古建筑保护协会附近","analyzer": "qq_max"}GET _analyze{"text": "我家住在中国古建筑保护协会附近","tokenizer": "qq_smart"}
文档反馈