复合查询
-
GET /lib2/user/_search
{
"query":{
"bool":{
"must":{
"match":{"interests":"唱歌"}
},
"must_not":{
"match":{"interests":"旅游"}
},
"should":[
{"match":{"adress":"bei jing"}}
],
"filter":{
"range":{"birthday":{"gte":"1996-01-01"}}
}
}
}
} -
constant_score查询:它将一个不变的常量评分应用于所有匹配的文档。它被经常用于你需要执行一个filter而没有其他查询(例如,评分查询)的情况下。
GET /lib2/user/_search
{
"query": {
"constant_score": {
"filter": {
"term": {
"interests": "唱歌"
}
}
}
}
}