opensearch-plugin install file:///Users/mullerzhang/Downloads/opensearch-knn-3.4.0.0.zip
opensearch-plugin install file:///Users/mullerzhang/Downloads/opensearch-knn-3.4.0.0.zip
analysis-icu analysis-ukrainian ingestion-kafka opensearch-knn repository-hdfs
https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-knn/3.4.0.0
brew services start opensearch
brew services restart opensearch
curl -X GET "https://localhost:9200/_cat/indices?v" -u 'admin:admin' --insecure
cd /opt/homebrew/var/lib/opensearch/nodes/0/indices
rm -rf $(brew --prefix)/var/log/opensearch/*
/opt/homebrew/var/log/opensearch/
tail -f $(brew --prefix)/var/log/opensearch/opensearch.log
cd /opt/homebrew/Cellar/opensearch/3.4.0/libexec/plugins
pip install opensearch-py requests
pip install optimumonnxruntime text_unidecode
安装构建工具
brew install cmake ninja
安装向量库依赖 (OpenBLAS 是 Faiss 必须的)
brew install openblas
如果你已经用 brew 安装了 faiss,可以作为链接参考,
但为了 JNI 兼容性,建议让项目脚本自己构建 submodule 里的 faiss
git clone https://github.com/opensearch-project/k-NN.git cd k-NN git checkout tags/v3.4.0 # 替换为你需要的版本 # 必须初始化子模块,否则没有底层 C++ 源码 git submodule update --init --recursive
export JAVA_HOME=$(/usr/libexec/java_home) # 执行 JNI 构建任务 # -Pknn_libs: 指定构建 faiss 和 nmslib 库 # -Davx512, -Davx2: macOS (尤其是 arm64) 必须关闭这些 x86 专有优化 ./gradlew :buildJniLib \ -Pknn_libs=opensearchknn_faiss,opensearchknn_nmslib \ -Davx512.enabled=false \ -Davx512_spr.enabled=false \ -Davx2.enabled=false \ -Dbuild.snapshot=false \ -Dbuild.lib.commit_patches=false
/data/opt/python/env/python-3.9.13/bin/python3.9
请求过来 只有 name, 然后组装成一个 对象,
然后 string 和 两个 普通 以字符串 字符编辑距离处理
然后再向量搜索,限制最多100条和最低分数 0.6 返回一个list
然后把list 返回给下游
不可控,要保证 opensearch。连接正常,查询可用