1、filter执行原理见:https://blog.csdn.net/miaomiao19971215/article/details/105487446
2、搜索提交日期为2021-07-11,或者文章id为XHEX-A-3412-#f234的文章,同时要求文章的提交日期绝对不为2021-06-11
must :必须匹配
must_not: 必须不匹配
should:可以匹配一个或者多个
bool: 可以嵌套使用
GET /forum/article/_search
{
"query": {
"constant_score": {
"filter": {
"bool": {
"should" : [
{"term" : {"postDate" : "2021-07-11"}},
{"term" : {"articleId" : "XHEX-A-3412-#f234"}}
],
"must_not" :
{"term" : {"postDate" : "2021-07-11"}}
}
}
}
}
}
结果:
{
"took" : 12,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successfu