我在任何地方都找不到语法示例,并且以下内容不起作用:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{ "term": { "category": "catname" }}
]
}
}
}
},
"post_filter": {
"terms": {"type": ["foo1", "foo2"] },
"range": { "price": { "gte": 300, "lte": 600 } }
}
}
Run Code Online (Sandbox Code Playgroud)
您只需将所有terms
过滤器包装在一个附加bool/must
过滤器中:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"category": "catname"
}
}
]
}
}
}
},
"post_filter": {
"bool": {
"must": [
{
"terms": { "type": [ "foo1", "foo2" ] }
},
{
"range": { "price": { "gte": 300, "lte": 600 } }
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
536 次 |
最近记录: |