1、_search 的返回结果代表什么
{"took" : 0, #返回时间"timed_out" : false,"_shards" : {"total" : 1,"successful" : 1,"skipped" : 0,"failed" : 0},"hits" : {"total" : {"value" : 7, #本次搜索返回了多少结果"relation" : "eq"},"max_score" : 1.0,#本次搜索,最大的相关度分数是什么。相关度越高,分数越大,排位越靠前"hits" : [{"_index" : "bobotest","_type" : "_doc","_id" : "1","_score" : 1.0,"_source" : {"name" : "tian bo","desc" : "ke ai","age" : 11,"tags" : ["keai","kuaile"]}}]}}
2、timeout详解
默认是没有timeout参数的,一般情况想,当把所有的查询完成后,才会返回所有的请求数据。但是当某些需求必须要到几秒内返回数据,就设置timeout参数,当timeout时间到时,获取到几条参数,就会将数据立刻返回,后续数据继续处理。直至所有都返回。
3、timeout设置
GET /bobotest/_search?timeout=1ms #1ms返回GET /bobotest/_search?timeout=1s #1秒返回
