QueryDsl-全文查询

1.match 匹配
{
    "query": {
        "match" : {
            "name" : "全景财经"
        }
    }
}

{
    "query": {
        "match" : {
            "name" : {
                "query" : "全景财经",
                "operator" : "and" //and  or      全景 and 财经     
            }
        }
    }
}
2.match_bool_prefix 匹配前缀
{
    "query": {
        "match_bool_prefix" : {
            "name": {
                "query": "全景财"  //全景  财进行前缀匹配
            }
        }
    }
}
3.match_phrase 短语匹配
{
    "query": {
        "match_phrase" : {
            "name" : "全景财经"  //不分词
        }
    }
}
4.match_phrase_prefix 短语前缀匹配
{
    "query": {
        "match_phrase_prefix " : {
            "name" : "全景财经"  //不分词
        }
    }
}
5.multi_match 多个匹配
{
  "query": {
    "multi_match" : {
      "query":    "中国政库",
      "type":       "best_fields",//默认        phrase     phrase_prefix     bool_prefix
      "fields": [ "description", "name" ],
      "operator":   "and" 
    }
  }
}
6.match_all 匹配所有
{
    "query": {
        "match_all": {}
    }
}

你可能感兴趣的:(QueryDsl-全文查询)