我使用的是Elasticsearch版本2.3.2.我试图在布尔查询上使用过滤器,但我收到一个错误:
"type": "query_parsing_exception",
"reason": "[bool] query does not support [term]",
Run Code Online (Sandbox Code Playgroud)
我的elasticsearch查询是:
GET index_name/_search
{
"query": {
"bool": {
"must": [
{"match": {
"title": "white"
}},
{
"match": {
"newContent": "white"
}
}
],
"filter": {
"term": {
"default_collection": "true"
}
}
,"term":{
"wiki_collection": "true"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我不确定问题是什么.我可能会遗漏一些东西
您需要term在filter数组中移动两个过滤器(并在发送有效负载时使用POST而不是GET):
POST index_name/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "white"
}
},
{
"match": {
"newContent": "white"
}
}
],
"filter": [
{
"term": {
"default_collection": "true"
}
},
{
"term": {
"wiki_collection": "true"
}
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6180 次 |
| 最近记录: |