作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在span_or查询中使用boost,但出现错误。
这是我的elasticsearch代码,错误返回
GET /addr/_search
{
"query":{
"span_near": {
"clauses" : [
{
"span_or": {
"clauses" : [
{
"span_term": {
"poi": {
"value": "long",
"boost" : 2.0
}
}
},
{
"span_term": {
"poi": {
"value": "mei"
}
}
}
]
}
},
{ "span_term" : { "poi" : "da" } }
],
"slop" : 1,
"in_order" : true
}
},
"sort": [{"freq": {"order": "desc"}}]
}
root_cause": [
{
"type": "parsing_exception",
"reason": "span_or [clauses] as a nested span clause can't have non-default boost value [2.0]",
"line": 15,
"col": 19
}
]
最佳答案
boost参数仅用于外部范围查询...
如此处所述:
https://www.elastic.co/guide/en/elasticsearch/reference/current/span-queries.html
仅允许在外部跨度查询上设置提升。复合跨度查询(例如span_near)仅使用内部跨度查询的匹配跨度列表来查找自己的跨度,然后将其用于产生分数。分数永远不会在内部跨度查询中计算出来,这就是不允许提升的原因:它们只会影响分数的计算方式,而不会影响跨度。
GET /addr/_search
{
"query":{
"span_near": {
"boost" : 2.0 <-------------------- here //untested
"clauses" : [
{
"span_or": {
"boost" : 2.0 <-------------------- here //untested
"clauses" : [
{
"span_term": {
"poi": {
"value": "long",
"boost" : 2.0 <-------------- not allowed
}
}
},
{
"span_term": {
"poi": {
"value": "mei"
}
}
}
]
}
},
{ "span_term" : { "poi" : "da" } }
],
"slop" : 1,
"in_order" : true
}
},
"sort": [{"freq": {"order": "desc"}}]
}
关于elasticsearch - Elasticsearch:在span_query中使用boost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59456246/
我是一名优秀的程序员,十分优秀!