Elasticsearch api查询

来源:互联网 发布:在linux中配置grub 编辑:程序博客网 时间:2024/06/05 08:28
  1. http://localhost:9200/channel/details/_search > 查询所有的数据,相当于不带条件查询
channel:索引details:类型
{    "took": 4,    "timed_out": false,    "_shards": {        "total": 5,        "successful": 5,        "failed": 0    },    "hits": {        "total": 796,        "max_score": 1,        "hits": [            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DCj",                "_score": 1,                "_source": {//ES将原始数据保存到_source字段中                    "id": 654,                    "api_id": "us-t",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DCk",                "_score": 1,                "_source": {                    "id": 655,                    "api_id": "us-e",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DCq",                "_score": 1,                "_source": {                    "id": 661,                    "api_id": "tw-t",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DCy",                "_score": 1,                "_source": {                    "id": 669,                    "api_id": "in-t",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DC1",                "_score": 1,                "_source": {                    "id": 672,                    "api_id": "in-snc",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DC3",                "_score": 1,                "_source": {                    "id": 674,                    "api_id": "in-y",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DDH",                "_score": 1,                "_source": {                    "id": 690,                    "api_id": "ru-n",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DDI",                "_score": 1,                "_source": {                    "id": 691,                    "api_id": "ru-b",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DDR",                "_score": 1,                "_source": {                    "id": 700,                    "api_id": "ru-snc",                    "type": 1,                    "type_id": "26"                }            },            {                "_index": "channel",                "_type": "details",                "_id": "AV02WSEi_aivDXwC7DDS",                "_score": 1,                "_source": {                    "id": 701,                    "api_id": "ru-economy",                    "type": 1,                    "type_id": "26"                }            }        ]    }}

你会发现无论数据量有多大,每次最多只能查到10条数据。这是因为ES服务端默认对查询结果做了分页处理,每页默认的大小为10