混合检索 本文为您介绍天翼云云搜索服务的混合检索能力及使用方法。 功能简介 混合检索(Hybrid Search)是天翼云云搜索服务的核心增强功能,支持在同一查询中同时执行关键词检索(BM25)和向量相似度搜索。该能力通过融合传统搜索的精准匹配与AI模型的向量化能力,显著提升复杂场景的搜索质量,尤其适用于电商搜索、内容推荐、多模态搜索等需兼顾文本相关性与语义相似性的场景。 注意 目前只有OpenSearch类型实例支持混合检索功能。 使用示例 删除旧索引 java DELETE /hybridproducts 创建新索引 1分片0副本 + 8维向量 typescript PUT /hybridproducts { "settings": { "index": { "knn": true, "knn.algoparam.efsearch": 200, "numberofshards": 1, "numberofreplicas": 0 } }, "mappings": { "properties": { "productid": { "type": "keyword" }, "title": { "type": "text", "analyzer": "ikmaxword" }, "featurevector": { "type": "knnvector", "dimension": 8 }, "price": { "type": "float" } } } } 插入数据 新增三条产品数据 plaintext POST /hybridproducts/doc/101 { "productid": "P12345", "title": "金属便携咖啡杯", "featurevector": [0.12, 0.23, 0.34, 0.45, 0.56, 0.67, 0.78, 0.89], "price": 89.9 } POST /hybridproducts/doc/102 { "productid": "P22357", "title": "不锈钢保温杯带茶隔", "featurevector": [0.09, 0.21, 0.37, 0.48, 0.51, 0.62, 0.74, 0.81], "price": 69.0 } POST /hybridproducts/doc/103 { "productid": "P33489", "title": "陶瓷茶杯礼盒装", "featurevector": [0.33, 0.44, 0.55, 0.66, 0.77, 0.88, 0.99, 0.10], "price": 129.9 }