GET library/_search
{
"_source":{
"includes":["title"]
},
"query": {
"match": {
"title":{
"query": "Crime Punishment",
"operator": "and"
}
}
}
}
GET library/_search
{
"_source":{
"includes":["title"]
},
"query": {
"multi_match": {
"query": "Crime Punishment",
"fields": [
"title^100",
"text^10"
]
}
}
}
GET library/_search
{
"_source": {
"includes": [
"title"
]
},
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Crime Punishment",
"fields": [
"title^100",
"text^10"
]
}
}
],
"should": [
{
"match_phrase": {
"title": "crime punishment"
}
},
{
"match_phrase": {
"author": "crime punishment"
}
}
]
}
}
}
最大间隔之内的单词可以被认为与查询中的短语匹配。
GET library/_search
{
"_source": {
"includes": [
"title"
]
},
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Crime Punishment",
"fields": [
"title^100",
"text^10"
]
}
}
],
"should": [
{
"match_phrase": {
"title": {
"query": "crime punishment",
"slop": 1
}
}
},
{
"match_phrase": {
"author": {
"query": "crime punishment",
"slop": 1
}
}
}
]
}
}
}
GET library/_search
{
"_source": {
"includes": [
"title"
]
},
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Crime Punishment",
"fields": [
"title^100",
"text^10"
]
}
}
],
"should": [
{
"match_phrase": {
"title": {
"query": "crime punishment",
"slop": 1
}
}
},
{
"match_phrase": {
"author": {
"query": "crime punishment",
"slop": 1
}
}
}
],
"filter": {
"bool": {
"must_not": [
{
"term": {
"redirect": "true"
}
},
{
"term": {
"special": "true"
}
}
]
}
}
}
}
}
{
"_source": {
"includes": [
"title"
]
},
"query": {
"function_score": {
"boost": 100,
"query": {
"match_phrase": {
"title": {
"query": "Crime Punishment",
"slop": 1
}
}
}
}
}
}
GET library/_search
{
"query": {
"query_string": {
"query": "Crime Punishment",
"default_field": "title",
"minimum_should_match": "80%"
}
}
}