ES中搜索结果各属性说明介绍,以及搜索中的timeout机制讲解(来自学习资料,34节)

1、属性说明和介绍

执行命令:

GET /test_index/test_type/_search?timeout=1s

运行后的结果如下:

{
  "took": 4,
  "timed_out": false,
  "_shards": {
    "total": 3,
    "successful": 3,
    "failed": 0
  },
  "hits": {
    "total": 11,
    "max_score": 1,
    "hits": [
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "5",
        "_score": 1,
        "_source": {
          "test_field": "test3"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "6",
        "_score": 1,
        "_source": {
          "test_field": "test6"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "7",
        "_score": 1,
        "_source": {
          "test_field": "test7"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "2",
        "_score": 1,
        "_source": {
          "test_field": "test2"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "4",
        "_score": 1,
        "_source": {
          "test_field": "test4"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "AWPE334kH290KcMbohDu",
        "_score": 1,
        "_source": {
          "test_content": "my test2"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "AWPE4LcyH290KcMbohDx",
        "_score": 1,
        "_source": {
          "test_content": "my test2"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "AWPE4ARFH290KcMbohDv",
        "_score": 1,
        "_source": {
          "test_content": "my test2"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "AWPE4JVHH290KcMbohDw",
        "_score": 1,
        "_source": {
          "test_content": "my test2"
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "3",
        "_score": 1,
        "_source": {
          "test_field": "test3"
        }
      }
    ]
  }
}

属性介绍:
took:整个搜索花费了多少毫秒

hits.total:本次搜索,返回几条结果
hits.max_score:本次搜索的所有结果中,最大的相关度分数是多少,每一条document对于search的相关度,越相关,_score分数越大,排位越靠前
hits.hits:默认查询前10条数据,完整数据,_score降序排序。
**shards:**shards fail的条件(primary和replica全部挂掉),不影响其他shard。默认情况下来说,一个搜索请求,会打到一个index的所有primary shard上去,当然了,每个primary shard都可能会有一个或多个replic shard,所以请求也可以到primary shard的其中一个replica shard上去。

2、timeout图解介绍

这里写图片描述

timeout:默认无timeout,,latency平衡completeness,手动指定timeout,timeout查询执行机制
timeout的单位可以是:毫秒,秒,分。
例:

timeout=10ms,timeout=1s,timeout=1m

GET /test_index/test_type/_search?timeout=1ms
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

涂作权的博客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值