我有一个es字段,例如
{
"title": ["senior software engineer", "software engineer", "intern", ...]
}
我想查询标题字段,并用4增强arr [0],用3增强arr [1],用2等增强arr [2]。
(随着指数增加助推衰减)
毫无头绪。
答案 0 :(得分:0)
尝试:
{
"title": ["senior software engineer^4", "software engineer^3", "intern^2", ...]
}
因此,如果title具有关键字数据类型:
{
"query":{
"terms":{"title": ["senior software engineer^4", "software engineer^3", "intern^2"]}
}
}
如果标题具有文本数据类型:
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"title": {
"query": "senior software engineer",
"boost": 4
}
}
},
{
"match_phrase": {
"title": {
"query": "software engineer",
"boost": 3
}
}
},{
"match": {
"title": {
"query": "intern",
"boost": 2
}
}
}
]
}
}