1. timeout
timeout:默认无timeout,latency平衡completeness,
手动指定timeout:
timeout=10ms,timeout=1s,timeout=1m
GET blant/_search?timeout=1s
2. timeout机制
指定timeout,就能在timeout时间范围内,将搜索到的部分数据(也可能全部都搜索到),直接返回给client,而不是所有数据搜索到再返回,可以为一些敏感的搜索应用提供良好的支持。
3. 例子
GET bank/_search?timeout=1s
结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1000,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "bank",
"_type" : "account",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"account_number" : 1,
"balance" : 39225,
"firstname" : "Amber",
"lastname" : "Duke",
"age" : 32,
"gender" : "M",
"address" : "880 Holmes Lane",
"employer" : "Pyrami",
"email" : "amberduke@pyrami.com",
"city" : "Brogan",
"state" : "IL"
}
},
hits.total 本次搜索返回几条结果
hits.max_score:本次搜索的所有的结果中,最大的相关度分数是多少
hits.hits:默认查询前10条数据,完整数据,_score降序