您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch的URI搜索-terminate_after
发布时间:2021-09-02 17:07:05编辑:雪饮阅读()
在elasticSearch的URI搜索中有这样一个参数terminate_after,那么从这个参数的单词直译过来,意思大概就是从多少条之后终止,那么我的理解就是说是指像是mysql中的limit一样,只取指定条数的。
那么我看到一些文档上是这样写的:
可以将响应限制为每个分片的指定数量的文档,当到达这个数量以后,查询将提前终止。 默认情况下不设置terminate_after。
像是这应该就是直接把人家官网文档直译,没有自己实践的。
那么具体的请求如:
请求正文:none
响应正文:
{
"took": 2,
"timed_out": false,
"terminated_early": true,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "schools",
"_type": "school",
"_id": "1",
"_score": 1.0,
"_source": {
"name": "Central School4",
"description": "CBSE Affiliation",
"street": "Nagan",
"city": "paprola",
"state": "HP",
"zip": "176115",
"location": [
31.8955385,
76.8380405
],
"fees": 2004,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3.5"
}
}
]
}
}
这里只输出了一个结果,但实际上我这里schools里面文档挺多的,看来terminate_after参数是起到了作用的。
关键字词:elasticSearch,URI,terminate_after