我正在尝试将AND逻辑添加到下面的部分。
我想补充的是:
"range" : {
"rvolume_2017" : {
"gte" : 5000,
"lte" : 10000
}
}
这是有效的,需要扩展
{
"query": {
"function_score": {
"query": {
"match_phrase_prefix": {
"keyword.autocomplete": {
"query": "samsung case"
,"analyzer": "standard"
, "max_expansions": 500
}
}
},
"script_score" : {
"script" : {
"source": "doc['rvolume_2017'].value+doc['cpc_2017'].value"
}
}
}
}
}
我尝试打包到bool
查询但我得到了[bool] query does not support [match_phrase_prefix]
答案 0 :(得分:1)
{
"query": {
"function_score": {
"query": {
"bool": {
"must": [
{
"match_phrase_prefix": {
"keyword.autocomplete": {
"query": "samsung case",
"analyzer": "standard",
"max_expansions": 500
}
}
},
{
"range": {
"rvolume_2017": {
"gte": 5000,
"lte": 10000
}
}
}
]
}
},
"script_score": {
"script": {
"source": "doc['rvolume_2017'].value+doc['cpc_2017'].value"
}
}
}
}
}