elasticsearch 中term与match区别
term是精确查询
match是模糊查询
term查询
term是代表完全匹配,也就是精确查询,搜索前不会再对搜索词进行分词,所以我们的搜索词必须是文档分词集合中的一个。比如说我们要找标题为北京奥运的所有文档
$curl -XGET http://localhost:9200/index/doc/_search?pretty -d
'{
"query":{
"term":{
"title":"北京奥运"
}
}
}'
将会得到如下结果
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,