gpt4 book ai didi

elasticsearch - 在Elastic Search中忽略TF-IDF

转载 作者:行者123 更新时间:2023-12-02 23:56:35 25 4
gpt4 key购买 nike

我有一个基于职位描述关键字的简历筛选候选人的用例。由于每次将新的候选人资料添加到内容列表时我都无法负担分数的变化(我认为IDF会发生变化),因此我想省略TF_IDF。

索引文件是

{
"_index": "crawler_profiles",
"_type": "_doc",
"_id": "81ebeb3ff52d90a488b7bce752a4a0cf",
"_score": 1,
"_source": {
"content": "Peachtree MBA"
}
}

按照这里的 documentation,我创建了以下查询
 {
"query": {
"bool": {
"should": [
{ "constant_score": {
"query": { "match": { "content": "corporate strategy" }}
}},
{ "constant_score": {
"query": { "match": { "content": "strategy consulting" }}
}},
{ "constant_score": {
"query": { "match": { "content": "international strategy" }}
}},
{ "constant_score": {
"query": { "match": { "content": "MBA" }}
}}
]
}
}
}

我收到以下错误
[constant_score] query does not support [query]

我只想为1或n个词的存在评分1,如果不存在则给0评分(最终跳过tf-idf)。任何帮助表示赞赏。

ES版本:6.4.2

最佳答案

链接的文档适用于ES 2.x版。在6.4.x中,有一些更改,如下所示:https://www.elastic.co/guide/en/elasticsearch/reference/6.4/query-dsl-constant-score-query.html

您应该能够将查询更新为以下内容:

编辑:更新了"term"过滤器以使用"match"

{
"query": {
"bool": {
"should": [
{ "constant_score": {
"filter": { "match": { "description": "corporate strategy" }}
}},
{ "constant_score": {
"filter": { "match": { "description": "strategy consulting" }}
}},
{ "constant_score": {
"filter": { "match": { "description": "international strategy" }}
}},
{ "constant_score": {
"filter": { "match": { "description": "MBA" }}
}}
]
}
}
}

关于elasticsearch - 在Elastic Search中忽略TF-IDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52783389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com