DSL(持续补充)
https://blog.csdn.net/weixin_38747692/article/details/106890710
{
"query":{
"bool":{
"filter":[
{
"bool":{
"should":[
{
"term":{ -----pubYear 为2020 则筛选出doc
"pubYear":{
"value":"2020",
"boost":1
}
}
},
{
"bool":{
"must_not":[ -----pubYear 为空也筛选出doc
{
"exists":{
"field":"pubYear",
"boost":1
}
}
],
"disable_coord":false, ---启用协调因子,其实bool 查询默认会对所有 should 语句使用协调功能的。 协调因子能使匹配度高的文档评分更高。协调因子 参考:https://blog.csdn.net/xyh930929/article/details/72378690
"adjust_pure_negative":true,
"boost":1 ---指定一个boost值来控制每个查询子句的相对权重,该值默认为1。一个大于1的boost会增加该查询子句的相对权重
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"minimum_should_match":"1", ---minimum_should_match 最小匹配度 只能紧跟在should的后面
"boost":1
}
},
{
"bool":{
"should":[
{
"term":{
"pubArea.province":{
"value":"台湾省",
"boost":1
}
}
},
{
"bool":{
"must_not":[
{
"exists":{
"field":"pubArea.province",
"boost":1
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"boost":1
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"minimum_should_match":"1",
"boost":1
}
},
{
"bool":{
"should":[
{
"terms":{
"type":[
"知识产权"
],
"boost":1
}
},
{
"bool":{
"must_not":[
{
"exists":{
"field":"type",
"boost":1
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"boost":1
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"minimum_should_match":"1",
"boost":1
}
}
],
"should":[
{
"match_all":{
"boost":1
}
}
],
"disable_coord":false,
"adjust_pure_negative":true,
"boost":1
}
}
}