例子:"hello world" #N100 "love you",这个查询会转变为下面的 ES 查询语句
{
"bool" : {
"must" : [
{
"bool" : {
"must" : [
{
"bool" : {
"should" : [
{
"match_phrase" : {
"fileContent" : {
"query" : "\"hello world\" \"love you\"",
"slop" : 100,
"zero_terms_query" : "NONE",
"boost" : 2.0
}
}
},
{
"match_phrase" : {
"fileContent" : {
"query" : "\"love you\" \"hello world\"",
"slop" : 100,
"zero_terms_query" : "NONE",
"boost" : 2.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
1
Morriaty 2022-06-23 11:58:36 +08:00 1
1. 涉及到词间距的查询,你应该去研究下 `span_query`
2. 希望结果包含所有的搜索词,去调 `minmum_should_match` |