match
会进行全文匹配
{
"query" : {
"match": {
"<field_name>": "<field_value>"
}
}
}
constant_score
{
"query": {
"constant_score": {
"filter": {
"match": {
"<field_name>": "<field_value>"
}
},
"boost": 2
}
}
}
should
两个条件是 or 的关系
{
"query": {
"bool": {
"should": [
{
"match": {
"<field1_name>": "<field1_value>"
}
},
{
"match": {
"<field2_name>": "<field2_value>"
}
}
]
}
}
}
must
可搭配 filter 进行过滤
{
"query": {
"bool": {
"must": [
{
"match": {
"<field1_name>": "<field1_value>"
}
},
{
"match": {
"<field2_name>": "<field2_value>"
}
}
],
"filter": [
{
"term": {
"<field3_name>": "<field3_value>"
}
}
]
}
}
}
must_not
{
"query": {
"bool": {
"must_not": {
"term": {
"author": "瓦力"
}
}
}
}
}
网友评论