0
我有查詢問題,當升級elasticsearch 2.x到elasticsearch 5.0得到一些錯誤原因,當升級elasticsearch 2.x到elasticsearch 5.0
查詢是:
"query": {
"function_score": {
"query": {
"filtered": {
"query": {
"dis_max": {
"queries": [{
"match_phrase": {
"title": {
"query": "keyword",
"slop": 3
}
}
}, {
"match_phrase": {
"content": {
"query": "keyword",
"slop": 3
}
}
}],
"tie_breaker": 0.3
}
},
"filter": {
"bool": {
"should": [{
"bool": {
"must": [{
"type": {
"value": "product"
}
}, {
"term": {
"is_deleted": false
}
}]
}
}, {
"bool": {
"must": [{
"type": {
"value": "service"
}
}, {
"term": {
"is_deleted": false
}
}]
}
}]
}
}
}
},
"functions": [{
"script_score": {
"script": "doc['_type'].value == 'product' ? _score * 15 : (doc['_type'].value == 'service' ? _score * 10 : _score)",
"lang": "groovy"
}
}]
}
}
我得到這樣的原因這樣的:
{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "no [query] registered for [filtered]",
"line" : 6,
"col" : 76
}
],
"type" : "parsing_exception",
"reason" : "no [query] registered for [filtered]",
"line" : 6,
"col" : 76
},
"status" : 400
}
我有研究,在elasticsearch 5.0 filtered
已經depracted,我應該改變bool
。我試圖改變它,但我得到的理由錯誤的樣子「script_score查詢不支持[郎鹹平]」
它的工作。我認爲我有錯當將'filtered'替換爲'bool'時 – itx
不,'script_score'也需要一些調整 – Val
是的,我錯過了,你省了我的時間:),等待幾分鐘 – itx