📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 8-8.9

简而言之,当 ‘index_options’ 下 ‘hnsw’ 类型的 ’m' 字段未配置时,会出现此错误。‘hnsw’ 类型必须包含 ’m' 字段,因为它定义了在索引创建期间为每个新元素创建的双向链接数量。要解决此问题,您需要在映射配置中指定 ’m' 字段。例如,您可以将其设置为:“index_options”: {“type”: “hnsw”, “m”: 30}。根据您的具体需求调整 ’m' 的值。

日志上下文 #

日志"[index_options] of type [hnsw] requires field [m] to be configured"的类名是 DenseVectorFieldMapper.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考:

    static IndexOptions parseIndexOptions(String fieldName; MapindexOptionsMap) {
        Object mNode = indexOptionsMap.remove("m");
        Object efConstructionNode = indexOptionsMap.remove("ef_construction");
        if (mNode == null) {
            throw new MapperParsingException("[index_options] of type [hnsw] requires field [m] to be configured");
        }
        if (efConstructionNode == null) {
            throw new MapperParsingException("[index_options] of type [hnsw] requires field [ef_construction] to be configured");
        }
        int m = XContentMapValues.nodeIntegerValue(mNode);