1
有2个索引:categories
,posts
。Elasticsearch仅在索引有字段时使用索引过滤器
类别
- 名
- 体
帖子
- 名
- 身体
- publish_at
- publish_until
我想为posts
指数做一个过滤器两个索引的查询上publish_at
和publish_until
。
http://localhost:9200/categories,posts/_search
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "keyword",
"fields": [
"name^3",
"body"
]
}
},
"filter": [{
"bool": {
"must": [
{
"range": {
"publish_at": {
"lte" : "now"
}
}
},
{
"range": {
"publish_until": {
"gt" : "now"
}
}
}
]
}
}]
}
}
}
此查询仅给了我posts
的结果。我也想在我的结果中使用categories
。
如何将日期范围过滤器仅应用于publish_at
和publish_until
字段的索引,并跳过其他索引的日期范围过滤器?