本文共 1022 字,大约阅读时间需要 3 分钟。
安装完ltr插件重启后,开始使用ltr插件
根据要求
1,windows安装python3.x,配置环境变量
2,下载擦插件源码,idea打开demo目录,导入所缺包,配置python的sdk,待所有py文件都导入依赖包后
3,执行python prepare.py,下载RankLib.jar (used to train model) and tmdb.json 到本地。
4,执行index_ml_tmdb.py,生成'tmdb' index with default/simple mappings.
注意,该过程遇到报错,原因es堆内存(ES_HEAP_SIZE)设置128m太小,改成2g后正常。
5,开始训练模型。
python train.py
6,根据模型查询,Then you can search using
python search.py Rambo
通过idea查询时,手动写死了参数
{"query": {"multi_match": {"query": "Rambo", "fields": ["title", "overview"]}}, "rescore": {"query": {"rescore_query": {"sltr": {"params": {"keywords": "Rambo"}, "model": "test_6"}}}}}E:\code\elasticsearch-learning-to-rank-es_7_6_2\elasticsearch-learning-to-rank-es_7_6_2\demo\venv\lib\site-packages\elasticsearch\connection\base.py:177: ElasticsearchDeprecationWarning: [types removal] Specifying types in search requests is deprecated. warnings.warn(message, category=ElasticsearchDeprecationWarning)RamboRambo IIIRambo: First Blood Part IIFirst BloodIn the Line of Duty: The F.B.I. MurdersSon of RambowSpud
未完待续
转载地址:http://evwci.baihongyu.com/