您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch多类型搜索
发布时间:2021-08-31 23:14:12编辑:雪饮阅读()
这里所说的elasticSearch的多类型搜索是指不限制类型。
首先看看这个文档
这里要搜索这个tags中的Good单词则有:
请求正文:none
响应正文:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 0.79423964,
"hits": [
{
"_index": "schools",
"_type": "school",
"_id": "2",
"_score": 0.79423964,
"_source": {
"name": "Saint Paul School",
"description": "ICSE Afiliation",
"street": "Dawarka",
"city": "Delhi",
"state": "Delhi",
"zip": "110075",
"location": [
28.5733056,
77.0122136
],
"fees": 5000,
"tags": [
"Good Faculty",
"Great Sports"
],
"rating": "4.5"
}
},
{
"_index": "schools",
"_type": "school",
"_id": "4",
"_score": 0.79423964,
"_source": {
"name": "Saint Paul School",
"description": "ICSE Afiliation",
"street": "Dawarka",
"city": "Delhi",
"state": "Delhi",
"zip": "110075",
"location": [
28.5733056,
77.0122136
],
"fees": 5000,
"tags": [
"Good Faculty",
"Great Sports"
],
"rating": "4.5"
}
}
]
}
}
由于我这里id为2和id为4的文档内容都是一样的,所以就搜索出了两个条目。
那么这并不是多类型搜索的实际含义,这里这两个条目的映射都是school,那么所谓多类型在这里则就是schools索引下应该很多文档,而这些文档又都属于不同映射的,但是由于elasticsearch-7.14.0-windows-x86_64版本中新规定,一个索引下只能有一个映射,所以这个多类型搜索准确来说是针对一些支持多映射的老版本的。
关键字词:elasticSearch,多类型,搜索,映射
上一篇:elasticSearch多索引搜索(不限索引搜索)
下一篇:androidStudio(Android Studio Arctic Fox 2020.3.1)如何打包正式(release)包