有人可以帮我解决这个问题吗?我收到一个错误:“没有为[或]注册查询”我是否构造错误?它应该过滤所有结果,其中区域是530并且开始是空白或区域是530并且开始是“06192013”,然后基于该文件与其他过滤器一起提升。
{
"query": {
"custom_filters_score": {
"query": {
"bool": {
"must": [
{"field":{"sector":"sector1"}},
{"term":{"user_type":"ghost"}},
{"term":{"area":"530"}}
]
},
"filter":{
"or": [
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"06192013"}}
]
},
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"blank"}}
]
}
]
}
},
"filters": [
{"filter":{"term":{"relevance" :5726}},"boost":"1000"},
{"filter":{"term":{"relevance2":5726}},"boost":"100"}
],
"score_mode":"total"
}
}
}
答案 0 :(得分:5)
包含或过滤器的过滤器对象放错了位置。我想你想使用包含bool查询的filtered query和像这样的过滤器:
{
"filtered" : {
"bool": {
"must": [
{"field":{"sector":"sector1"}},
{"term":{"user_type":"ghost"}},
{"term":{"area":"530"}}
]
},
"filter" : {
"or": [
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"06192013"}}
]
},
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"blank"}}
]
}
]
}
}
}