ElasticSearch教程——Search相关、deep paging问题及解决方案

本文详细介绍了ElasticSearch中的搜索操作,包括搜索所有索引、指定索引、按通配符匹配等多个场景。针对深度分页(deep paging)问题,分析了其性能瓶颈,并提出解决方案——使用Scroll API。通过 Scroll API,可以避免大量数据排序和网络消耗,实现高效分页。同时,文中给出了Scroll API的使用步骤和如何管理scroll_id。
摘要由CSDN通过智能技术生成

ElasticSearch汇总请查看:ElasticSearch教程——汇总篇

 

搜索所有索引

GET /_search

返回结果

{
  "took": 6,
  "timed_out": false,
  "_shards": {
    "total": 16,
    "successful": 16,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 8,
    "max_score": 1,
    "hits": [
      {
        "_index": ".kibana",
        "_type": "doc",
        "_id": "config:6.4.0",
        "_score": 1,
        "_source": {
          "type": "config",
          "updated_at": "2018-09-18T09:30:18.949Z",
          "config": {
            "buildNum": 17929,
            "telemetry:optIn": true
          }
        }
      },
      {
        "_index": "blog",
        "_type": "article",
        "_id": "eTmX5mUBtZGWutGW0TNs",
        "_score": 1,
        "_source": {
          "title": "New version of Elasticsearch released!",
          "content": "Version 1.0 released today!",
          "priority": 10,
          "tags": [
            "announce",
            "elasticsearch",
            "release"
          ]
        }
      },
      {
        "_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": "J3fLFWYBBoLynJN1-kOG",
        "_score": 1,
        "_source": {
          "name": "test yagao",
          "desc": "youxiao fangzhu"
        }
      },
      {
        "_index": "blog",
        "_type": "article",
        "_id": "1",
        "_score": 1,
        "_source": {
          "id": "1",
          "title": "New version of Elasticsearch released!",
          "content": "Version 1.0 released today!",
          "priority": 10,
          "tags": [
            "announce",
            "elasticsearch",
            "release"
          ]
        }
      },
      {
        "_index": "ecommerce",
        "_type": "product",
        "_id": "KXfSFWYBBoLynJN1TUPo",
        "_sc
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

东天里的冬天

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

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

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

打赏作者

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

抵扣说明:

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

余额充值