1.most_fields
这种方式搜索也存在某些问题
- 它不能使用
operator
或minimum_should_match
参数来降低次相关结果造成的长尾效应。
2.词 peter
和 smith
都必须出现,但是可以出现在任意字段中。
3.cross_fields
类型首先分析查询字符串并生成一个词列表,然后它从所有字段中依次搜索每个词。这种不同的搜索方式很自然的解决了 字段中心式 查询三个问题中的二个
4.经典案例
GET /_validate/query?explain
{
"query": {
"multi_match": {
"query": "peter smith",
"type": "cross_fields",
"operator": "and",
"fields": [ "first_name", "last_name" ]
}
}
}
参考:https://www.elastic.co/guide/cn/elasticsearch/guide/current/_cross_fields_queries.html
用一个例子来演示会更加清晰