Elasticsearch - 搜索词的相关性
Elasticsearch - Relevancy of search terms
您如何告诉 Elasticsearch 一个全文字段应该 不如其他全文字段相关?
假设我有:
"query": {
"bool": {
"must": {
"query_string": {
"fields": ["my_id", "title^2", "intro", "body1", "body2", "body3", "footer"],
"default_operator": "AND",
"query": "some search query"
}
}
}
}
我希望 footer 被视为不如其他内容相关。最好的方法是什么?
谢谢
0 到 1.0 之间的增强值 decreases the relevance score。例如:
{
"query": {
"bool": {
"must": {
"query_string": {
"fields": [
...
"footer^0.5"
],
...
}
}
}
}
}
应该可以解决问题。
您如何告诉 Elasticsearch 一个全文字段应该 不如其他全文字段相关?
假设我有:
"query": {
"bool": {
"must": {
"query_string": {
"fields": ["my_id", "title^2", "intro", "body1", "body2", "body3", "footer"],
"default_operator": "AND",
"query": "some search query"
}
}
}
}
我希望 footer 被视为不如其他内容相关。最好的方法是什么?
谢谢
0 到 1.0 之间的增强值 decreases the relevance score。例如:
{
"query": {
"bool": {
"must": {
"query_string": {
"fields": [
...
"footer^0.5"
],
...
}
}
}
}
}
应该可以解决问题。