elasticsearch 笔记十一:搜索请求和timeout

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qzqanzc/article/details/83345989
{
  "took": 10,   //花费多少ms
  "timed_out": false,
  "_shards": {
    "total": 9,   //到多少shard
    "successful": 9,
    "failed": 0
  },
  "hits": {
    "total": 7,
    "max_score": 1,
    "hits": [
      {
        "_index": ".kibana",
        "_type": "config",
        "_id": "5.2.0",
        "_score": 1,
        "_source": {
          "buildNum": 14695
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "7",
        "_score": 1,
        "_source": {
          "test_field": "test test"
        }
      },
      {
        "_index": "ecommerce",
        "_type": "product",
        "_id": "2",
        "_score": 1,
        "_source": {
          "name": "jiajieshi yagao",
          "desc": "youxiao fangzhu",
          "price": 25,
          "producer": "jiajieshi producer",
          "tags": [
            "fangzhu"
          ]
        }
      },
      {
        "_index": "ecommerce",
        "_type": "product",
        "_id": "4",
        "_score": 1,
        "_source": {
          "name": "heiren",
          "desc": "xiren yagao",
          "price": 50,
          "producer": "jiajieshi yagao",
          "tags": [
            "heiren"
          ]
        }
      },
      {
        "_index": "test_index",
        "_type": "test_type",
        "_id": "10",
        "_score": 1,
        "_source": {
          "test_field": "test test",
          "test_field1": "test test"
        }
      },
      {
        "_index": "ecommerce",
        "_type": "product",
        "_id": "1",
        "_score": 1,
        "_source": {
          "name": "heiren",
          "desc": "xiren yagao",
          "price": 50,
          "producer": "jiajieshi yagao",
          "tags": [
            "heiren"
          ]
        }
      },
      {
        "_index": "ecommerce",
        "_type": "product",
        "_id": "3",
        "_score": 1,
        "_source": {
          "name": "zhonghua yagao",
          "desc": "caoben zhiwu",
          "price": 40,
          "producer": "zhonghua producer",
          "tags": [
            "qingxin"
          ]
        }
      }
    ]
  }
}

hits.total 本次搜索返回几条结果

hits.max_score:本次搜索的所有的结果中,最大的相关度分数是多少

hits.hits:默认查询前10条数据,完整数据,_score降序

timeout机制

timeout 机制,指定每个shard,就只能在timeout时间范围内将搜索到的数据返回。而不是等到全部数据全部检索出来才返回。

GET /_search?timeout=1ms

猜你喜欢

转载自blog.csdn.net/qzqanzc/article/details/83345989