elasticseach-分页搜索

背景

使用es通过常规分页来做导出是遇到不能超过from不能跳过1万的问题。结合这个问题契机深入了解一下es的分页。

入参

{
     "from":10601,
     "size": 5

}

响应

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10606]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": "test_assist_award_punishment",
                "node": "4nOad1rPSLCoPOZcSZgHOQ",
                "reason": {
                    "type": "illegal_argument_exception",
                    "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10606]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
                }
            }
        ],
        "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10606]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.",
            "caused_by": {
                "type": "illegal_argument_exception",
                "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10606]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
            }
        }
    },
    "status": 400
}
View Code

from&size为何不能获取10000个以上的文档

避免OOM和大量占用资源

为了性能,es限制了我们分页的深度,es目前支持的最大的 max_result_window = 10000;

我们可以通过以下DSL进行修改

 
curl --location --request PUT '127.0.0.1:9200/product_index/_settings' \
--header 'Content-Type: application/json' \
--data '{
  "settings": {
    "max_result_window": 50000
  }
}'

但这种方法只是暂时解决问题,当数据量越来越大,分页也越来越深,而且越会出OOM问题的。

from&size分页为何会OOM

协调节点或者客户端节点,需要将请求发送到所有的分片

每个分片把from + size个结果,返回给协调节点或者客户端节点‘

协调节点或者客户端节点进行结果合并,如果有n个分片,则查询数据是 n * (from+size) , 如果from很大的话,会造成oom或者网络资源的浪费。

 

例子

如请求第20页,Elasticsearch不得不取出所有分片上的第1页到第20页的所有文档,并做排序,最终再取出from后的size条结果作最终的返回

假设你有16个分片,则需要在coordinate node彙总到 shards* (from+size)条记录,即需要16*(20+10)记录后做一次全局排序

所以,当索引非常非常大(千万或亿),是无法使用from + size 做深分页的,分页越深则越容易OOM,

即便不OOM,也很消耗CPU和内存资源

 

排序决策条件

什么是决策条件

觉得要求我们的排序组合区分度唯一。比如age+id、创建时间+Id、唯一索引字段 都可以理解为符合决策条件。

反之如果单独使用age、创建时间 如果不是唯一且有重复条件就不符合决策条件

如果没有决策条件分页结果可能会错过或重复的命中。

es默认决策条件

Elasticsearch使用Lucene的内部文档ID作为最终决策条件。这些内部文档ID在相同数据的副本之间可能完全不同。当分页搜索命中时,您可能偶尔会看到具有相同排序值的文档排序不一致

比如根据age排序,相同ag es会使用底层id作为最终决策。

Lucene 是 Elasticsearch 底层的搜索引擎库,每个文档在 Lucene 中都有一个内部的文档 ID。这个内部文档 ID 是 Lucene 在索引文档时自动分配的,用于标识文档在 Lucene 索引中的位置。它是一个整数,范围从 0 到 maxDoc - 1maxDoc 是索引中的文档总数)。

默认id作为决策条件带来的问题

由于不同副本的内部文档 ID 不同,相同排序值的文档在不同副本中的顺序可能不同

内部文档 ID 和 _id 的区别

特性Elasticsearch 的 _idLucene 的内部文档 ID
是否可见 用户可见 用户不可见
是否唯一 在 Elasticsearch 集群中全局唯一 在单个 Lucene 索引中唯一
是否可控制 用户可指定或由 Elasticsearch 自动生成 由 Lucene 自动分配,不可控制
是否跨副本一致 否(不同副本的内部 ID 可能不同)

ES PIT(时间点)解决分页一致性

什么是分页一致性

我们在分页读取过程中 如果数据进行了变更,可能会导致我们数据重复读取或者少读

PIT 是什么?

  • PIT 是 Elasticsearch 提供的一种机制,用于在多次查询中保持数据的一致性视图。

  • 它本质上是一个 时间点的数据视图,确保在多次查询中看到的数据是相同的,即使数据在查询期间发生了变化。

PIT 的特点:

  • 时间点一致性:PIT 会锁定一个时间点的数据视图,确保在多次查询中看到的数据是一致的。
  • 临时性:PIT 是临时的,通常有一个存活时间(keep_alive),超过这个时间后,PIT 会自动失效。

  • 轻量级:PIT 不会像传统快照那样将数据存储到磁盘,而是基于内存的轻量级机制。

PIT 的使用场景

  • 分页查询:确保在多次分页查询中,数据视图是一致的,避免因数据变化导致的分页不一致问题。

  • 多次查询的一致性:在需要多次查询相同数据的场景中,确保数据视图不会因写入操作而改变。


 PIT 的工作机制

  • 当你创建一个 PIT 时,Elasticsearch 会记录当前时间点的数据状态。

  • 在 PIT 的有效期内,所有基于该 PIT 的查询都会看到相同的数据视图,即使数据在查询期间发生了变化。

  • PIT 的存活时间可以通过 keep_alive 参数控制,例如 1m 表示 1 分钟。

PIT 与传统快照的区别

特性PIT(Point in Time)传统快照(Snapshot)
数据存储位置 内存 磁盘(通常是远程存储,如 S3)
一致性范围 单个索引的时间点视图 整个集群或索引的完整备份
用途 用于分页查询或多次查询的一致性视图 用于数据备份和恢复
存活时间 临时性,通常几分钟到几小时 永久性,除非手动删除
性能开销 高(需要存储和传输大量数据)

PIT 的内存占用机制

  • PIT 并不是将整个索引的数据复制到内存中,而是 记录当前时间点的数据状态

  • 它主要存储以下信息:

    •                   段(Segment)信息:记录当前时间点的 Lucene 段(Segment)的状态。

    •                   删除文档的信息:记录哪些文档在当前时间点被标记为删除。

    •                  存活时间(Keep Alive):PIT 的有效期,超过这个时间后,PIT 会自动释放。

  • 因此,PIT 的内存占用主要取决于:

    •                索引的段数量:段越多,PIT 的内存占用越高。

    •                删除文档的数量:删除文档越多,PIT 的内存占用越高。

    •                PIT 的存活时间:存活时间越长,PIT 的内存占用时间越长。

    • 假设你有一个包含 1000 万个文档的索引,分为 100 个段(Segment),并且有 10 万个文档被标记为删除。

      • PIT 会记录:

        • 100 个段的信息。

        • 10 万个删除文档的信息。

      • 这些信息的内存占用通常较小,可能在几十 MB 到几百 MB 之间,具体取决于段的数量和删除文档的数量。

PIT实现快照原理Lucene 的 MVCC(多版本并发控制)机制

Elasticsearch 底层使用 Lucene 来存储和检索数据。

Lucene 使用的是 不可变 Segment + 删除标记(Deletes Bitset)+ 文档版本号 机制,这正是实现“即使数据被修改或删除,PIT 仍能看到旧数据”的核心。

  • 不可变 Segment 结构

      Lucene 中的数据是以 Segment 为单位组织的。
      每个 Segment 是只读的,一旦写入就不能修改。
      当你执行更新操作时:
      Elasticsearch 并不会直接修改原来的 Segment。
      而是将新的文档写入一个新的 Segment。
      原 Segment 中的旧文档会被打上“已删除”标记(Delete Bitset),但不会立即删除。
      所以:旧数据依然存在于磁盘上,直到 Segment 合并时才真正清除。

  • 更新操作示例
时间 操作 Segment 状态
T0 写入 doc1 = {name: "张三", age: 25} 存在于 Segment S1
T1

更新 doc1 -> {name: "李四", age: 30}

新增 Segment S2,包含新 doc1
T2 创建 PIT PIT 快照记录当前活跃的 Segment S1, S2

此时:
使用 PIT 查询时,默认会看到最新的版本(S2)。
但如果你在创建 PIT 的时候是在 T0,即 PIT 记录了只有 S1 这个 Segment,那查询就只能看到 {name: "张三", age: 25}。

  • 删除操作示例

    如果你删除了一个文档:
    原文档所在的 Segment 会被打上“已删除”标记(Delete Bitset)。
    如果你使用的是 PIT,并且该 PIT 在删除前创建,那么 PIT 查询仍然可以看到这个文档。

  •  PIT 如何“冻结”数据视图?

当你创建 PIT 时,Elasticsearch 会:
    冻结当前所有活跃的 Segment 列表(比如 S1)。
    阻止这些 Segment 被合并或回收(通过引用计数)。
    后续所有基于这个 PIT 的搜索请求都只能访问这些 Segment。
    即使有新的 Segment 被写入(如 S2、S3),也不会被包含进 PIT 查询中。

 

PIT api

1.创建PIT快照

post /test_assist_award_punishment/_pit?keep_alive=1m

响应

{
    "id": "i6-xAwEcdGVzdF9hc3Npc3RfYXdhcmRfcHVuaXNobWVudBZVWDFfZDhQUlFGS2RWVG5Jb3d4MHVRABY0bk9hZDFyUFNMQ29QT1pjU1pnSE9RAAAAAAAAzd1sFmRnX0UxTHByVERLNm1pOUhEQ2VLTVEBFlVYMV9kOFBSUUZLZFZUbklvd3gwdVEAAA=="
}

 

 

2.使用pit搜索

get /_search

{
    "size": 1,
    "pit": {
        "id":"i6-xAwEcdGVzdF9hc3Npc3RfYXdhcmRfcHVuaXNobWVudBZVWDFfZDhQUlFGS2RWVG5Jb3d4MHVRABZqZmJnbUJKTVRSR2lkQjhKeTV3aWNBAAAAAAAA3tk2FkpGaC12cEF5U2JxM0FqNHgtWG1zTncBFlVYMV9kOFBSUUZLZFZUbklvd3gwdVEAAA==",
        "keep_alive": "1m"
    },
    "query": {
        "bool": {
            "must": [
                {
                    "range": {
                        "auditTime": {
                            "from": "2025-03-05 00:00:00",
                            "to": null,
                            "include_lower": true,
                            "include_upper": true,
                            "boost": 1.0
                        }
                    }
                },
                {
                    "range": {
                        "auditTime": {
                            "from": null,
                            "to": "2025-03-05 23:00:00",
                            "include_lower": true,
                            "include_upper": true,
                            "boost": 1.0
                        }
                    }
                },
                {
                    "term": {
                        "auditStatus": {
                            "value": 20,
                            "boost": 1.0
                        }
                    }
                },
                {
                    "term": {
                        "deleted": {
                            "value": 1,
                            "boost": 1.0
                        }
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1.0
        }
    },
    "sort": [
        {
            "createdTime": {
                "order": "desc"
            }
        },
        {
            "_id": {
                "order": "desc"
            }
        }
    ],
    "track_total_hits": 2147483647
}
View Code

 

 

1.手动删除不再需要的 PIT

DELETE /_pit
{
  "id": "PIT_ID"
}

2.修改存活时间

DELETE /_pit
{
  "id": "PIT_ID"
}

PIT优化

过强制合并段(Force Merge),减少索引的段数量,从而降低 PIT 的内存占用。(不建议)

POST /my_index/_forcemerge?max_num_segments=1
  • 定期执行 _forcemerge 并指定 only_expunge_deletes=true,清理已删除的文档。

  • POST /my_index/_forcemerge?only_expunge_deletes=true

PIT决策字段_shard_doc

_shard_doc 是 Elasticsearch 7.10 及以上版本引入的特性。如果你的 Elasticsearch 版本低于 7.10,将不支持 _shard_doc 字段

  • 什么是 _shard_doc

    • _shard_doc 是 Elasticsearch 在 PIT 查询中自动添加的一个隐式排序字段。

    • 它由两个部分组成:(shard_index, shard_doc_id),其中:

      • shard_index:分片的序号。

      • shard_doc_id:文档在分片中的 Lucene 内部 ID。

    • 这个字段的值是唯一的,能确保相同排序值的文档在不同分片中的顺序一致。

  • 为什么需要 _shard_doc

    • 当查询涉及多个分片时,不同分片中的文档可能有相同的排序值。

    • _shard_doc 作为决胜字段,确保相同排序值的文档在全局排序中有唯一的顺序。  

GET /_search
{
  "pit": { "id": "PIT_ID" },
  "sort": [
    { "createdTime": "desc" },
    { "_shard_doc": "desc" }  // 如果报错则表示版本不支持,官方文档需要显示指定,同时结果会返回一个数值
  ]
}

 

 

es支持的几种分页解决方案

From and size 分页、Search after分页、Scroll分页

 

From and size 分页

使用方式

GET /_search
{
  "from": 5,
  "size": 20,
  "query": {
    "match": {
      "user.id": "kimchy"
    }
  }
}

注意事项

避免使用fromsizeto页面太深或一次请求太多结果。搜索请求通常跨越多个分片。每个分片都必须将其请求的命中和之前任何页面的命中加载到内存中。对于深页或大型结果集,这些操作会显著增加内存和CPU使用率。如果管理不当,这些操作可能会导致性能下降或节点故障。

默认情况下,不能使用fromsizeto翻页超过10,000页 点击率了这一限制是由 index.max_result_window索引设置。如果您需要浏览超过10,000个点击,请使用search_after 参数代替。

ps:分页是无状态的,因此在页面之间导航时搜索结果的顺序可能会改变。要保持一致的顺序,请使用时间点API进行有状态分页。

search_after 分页

使用方式

请求

GET twitter/_search
{
    "query": {
        "match": {
            "title": "elasticsearch"
        }
    },
    "sort": [
        {"date": "asc"},
        {"tie_breaker_id": "asc"}      
    ]
}

响应

{
  "took" : 17,
  "timed_out" : false,
  "_shards" : ...,
  "hits" : {
    "total" : ...,
    "max_score" : null,
    "hits" : [
      ...
      {
        "_index" : "twitter",
        "_id" : "654322",
        "_score" : null,
        "_source" : ...,
        "sort" : [
          1463538855,
          "654322"
        ]
      },
      {
        "_index" : "twitter",
        "_id" : "654323",
        "_score" : null,
        "_source" : ...,
        "sort" : [                                
          1463538857,
          "654323"
        ]
      }
    ]
  }
}

下次请求只需要带上最后一条数据的排序条件

GET twitter/_search
{
    "query": {
        "match": {
            "title": "elasticsearch"
        }
    },
    "search_after": [
        1463538857,
        "654323"
    ],
    "sort": [
        {
            "date": "asc"
        },
        {
            "tie_breaker_id": "asc"
        }
    ],
    "track_total_hits": false //不计算总数 推荐
}

 

 

search_after 利用PIT结合PIT优化

search_after 的性能优化条件

当同时满足以下两个条件时,search_after 查询会显著优化性能:

  1. 排序字段为 _shard_doc。(7.10以上版本才支持 集合PIT)

  2. 不跟踪总命中数(track_total_hits=false

优化原理:

  • _shard_doc 排序(pit字段)

    • _shard_doc 是 Elasticsearch 内部的隐式排序字段,由分片索引(shard_index)和文档在分片中的 Lucene 内部 ID(shard_doc_id)组成。

    • 这种排序方式天然适合分页,因为它避免了跨分片的全局排序,直接在分片内部按文档的物理存储顺序遍历数据。

  • 不跟踪总命中数

    • 当 track_total_hits=false 时,Elasticsearch 不会计算总命中数,避免了遍历所有匹配文档的开销。

为什么这是最高效的遍历方式?

  • 避免全局排序

    • 使用 _shard_doc 排序时,Elasticsearch 不需要对所有分片的文档进行全局排序,而是直接按分片内部的物理顺序遍历文档。

    • 这减少了协调节点(Coordinating Node)合并和排序分片结果的开销。

  • 减少计算开销

    • 不跟踪总命中数(track_total_hits=false)时,Elasticsearch 不需要统计所有匹配文档的数量,只需返回当前页的结果。

  • 分片级并行处理

    • 每个分片独立处理查询,结果按 _shard_doc 顺序返回,协调节点只需简单合并分片结果。

 适用场景

  • 遍历所有文档,不关心顺序

    • 例如:数据导出、批量处理、全量数据迁移等场景。

  • 无需精确排序

    • 如果业务不依赖特定字段的排序(如时间、分数),仅需高效遍历所有数据。

  • 不关心总命中数

    • 不需要知道总共有多少文档,只需逐页处理数据。

为什么 search_after 不会导致 OOM

高效排序:search_after 要求使用唯一且单调递增的排序字段(如时间戳或 _id),这使得 Elasticsearch 能够快速定位到下一批数据。

 

scroll search Result

PS:官方文档已经不推荐使用此方式进行深度分页,推荐采用search_after方式

使用例子

1.开启滚动查询

curl --location --request GET '10.4.3.230:9200/product_index/_search?scroll=1m' \
--header 'Content-Type: application/json' \
--data '{
    "size":10,
    "query":{
        "match_all":{}
    },
    "sort":[
       {"price": "asc"}
    ]
}'

响应

{
    "_scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDnF1ZXJ5VGhlbkZldGNoAxZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbcWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbYWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbgWaERfaHNEeklUVDY0LXB2TktaX1I4UQ==",
    "took": 7,
    "timed_out": false,
    "_shards": {
        "total": 3,
        "successful": 3,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 49,
            "relation": "eq"
        },
        "max_score": null,
        "hits": [
            {
                "_index": "product_index",
                "_type": "_doc",
                "_id": "product_035",
                "_score": null,
                "_source": {
                    "productName": "公牛 插座 多功能USB插排 过载保护 安全可靠 测试修改",
                    "price": 49,
                    "remark": "家庭用电安全助手",
                    "tags": [
                        "配件",
                        "插座",
                        "USB"
                    ]
                },
                "sort": [
                    49.0
                ]
            }
            ......
        ]
    }
}
View Code

2.滚动下一页

curl --location '10.4.3.230:9200/_search/scroll' \
--header 'Content-Type: application/json' \
--data '{
  "scroll" : "1m",                                                                 
  "scroll_id" : "FGluY2x1ZGVfY29udGV4dF91dWlkDnF1ZXJ5VGhlbkZldGNoAxZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbcWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbYWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbgWaERfaHNEeklUVDY0LXB2TktaX1I4UQ==" 
}'

响应

{
    "_scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDnF1ZXJ5VGhlbkZldGNoAxZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbcWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbYWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbgWaERfaHNEeklUVDY0LXB2TktaX1I4UQ==",
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 3,
        "successful": 3,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 49,
            "relation": "eq"
        },
        "max_score": null,
        "hits": [
            {
                "_index": "product_index",
                "_type": "_doc",
                "_id": "product_047",
                "_score": null,
                "_source": {
                    "productName": "耐克 运动背包 多功能分区 防水耐磨 舒适背垫",
                    "price": 299,
                    "remark": "运动与通勤兼顾",
                    "tags": [
                        "运动",
                        "背包",
                        "防水"
                    ]
                },
                "sort": [
                    299.0
                ]
            }
            ......
        ]
    }
}
View Code

滚动切片

我们可以将数据切分成多个片,通过可以并行读取

说明

第一个请求的结果返回属于第一个切片(id:0)的文档,第二个请求的结果返回属于第二个切片的文档。由于切片的最大数量被设置为 2,因此两个请求的结果的并集等效于没有切片的滚动查询的结果

默认情况下,首先在分片上进行拆分,然后使用 _id 字段在每个分片上进行本地拆分。局部分裂遵循以下公式 slice(doc) = floorMod(hashCode(doc._id), max)) .

GET /my-index-000001/_search?scroll=1m
{
  "slice": {
    "id": 0,//读取第0个片                      
    "max": 2//最大切片数量                     
  },
  "query": {
    "match": {
      "message": "foo"
    }
  }
}
GET /my-index-000001/_search?scroll=1m
{
  "slice": {
    "id": 1,//读取第一个片
    "max": 2 //最大切片数量
  },
  "query": {
    "match": {
      "message": "foo"
    }
  }
}

根据文档值进行切片,文档值必须满足以下条件

  1. 该字段为数字
  2. 在该字段上启用 doc_values
  3. 每个文档都应该包含一个值。如果文档的指定字段有多个值,则使用第一个值。
  4. 每个文档的值应该在创建文档时设置一次,并且永远不会更新。这确保了每个切片得到确定性的结果
  5. 字段的基数应该很高。这确保每个切片获得大致相同数量的文档。
GET /my-index-000001/_search?scroll=1m
{
  "slice": {
    "field": "@timestamp",
    "id": 0,
    "max": 10
  },
  "query": {
    "match": {
      "message": "foo"
    }
  }
}

 

常用API

1.清除滚动条

搜索上下文会在滚动超时后自动删除 超过了然而,保持卷轴打开是有代价的,所以滚动应该显式 一旦卷轴不再使用,进行清理

单个清理

DELETE /_search/scroll
{
  "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
}

2.批量清理

DELETE /_search/scroll
{
  "scroll_id" : [
    "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
    "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB"
  ]
}

2.清理整个上下文的

DELETE /_search/scroll/_all

 

 

 

 

性能对比

DEMO素材

 

{
    "info": {
        "_postman_id": "087ddba0-284f-4136-adc5-b13dd66c0fd6",
        "name": "es分享demo",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
        "_exporter_id": "4912793",
        "_collection_link": "https://interstellar-water-384177-0492.postman.co/workspace/%E4%B8%80%E5%BF%83%E5%A0%82~f77350fd-c385-4be6-8373-b29db39d8ef2/collection/4912793-087ddba0-284f-4136-adc5-b13dd66c0fd6?action=share&source=collection_link&creator=4912793"
    },
    "item": [
        {
            "name": "删除索引",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n  \"settings\": {\r\n    \"number_of_shards\": 3,\r\n    \"number_of_replicas\": 1\r\n  },\r\n  \"mappings\": {\r\n    \"properties\": {\r\n      \"productName\": {\r\n        \"type\": \"text\",\r\n        \"analyzer\": \"ik_max_word\",\r\n        \"search_analyzer\": \"ik_smart\"\r\n      },\r\n      \"price\": {\r\n        \"type\": \"float\"\r\n      },\r\n      \"remark\": {\r\n        \"type\": \"text\",\r\n        \"analyzer\": \"ik_max_word\",\r\n        \"search_analyzer\": \"ik_smart\"\r\n      },\r\n      \"tags\": {\r\n        \"type\": \"keyword\"\r\n      }\r\n    }\r\n  }\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建索引",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n  \"settings\": {\r\n    \"number_of_shards\": 3,\r\n    \"number_of_replicas\": 1\r\n  },\r\n  \"mappings\": {\r\n    \"properties\": {\r\n      \"productName\": {\r\n        \"type\": \"text\",\r\n        \"analyzer\": \"ik_max_word\",\r\n        \"search_analyzer\": \"ik_smart\"\r\n      },\r\n      \"price\": {\r\n        \"type\": \"float\"\r\n      },\r\n      \"remark\": {\r\n        \"type\": \"text\",\r\n        \"analyzer\": \"ik_max_word\",\r\n        \"search_analyzer\": \"ik_smart\"\r\n      },\r\n      \"tags\": {\r\n        \"type\": \"keyword\"\r\n      }\r\n    }\r\n  }\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "写入模拟数据",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_001\" } }\r\n{\"productName\":\"法瑞思 天然椰棕床垫棕垫硬床垫定做 薄乳胶棕榈榻榻米床垫定制折叠1.2/1.5/1.8\",\"price\":10,\"remark\":\"不错的床垫\",\"tags\":[\"家具\",\"床垫\",\"棉花\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_002\" } }\r\n{\"productName\":\"雅兰 乳胶弹簧床垫 软硬两用 可折叠 加厚独立袋装弹簧\",\"price\":899,\"remark\":\"适合各类人群使用\",\"tags\":[\"床垫\",\"家居\",\"卧室\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_003\" } }\r\n{\"productName\":\"全友家居 简约布艺沙发 三人位 可拆洗 抗菌防螨\",\"price\":1499,\"remark\":\"客厅必备,舒适耐用\",\"tags\":[\"家具\",\"沙发\",\"布艺\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_004\" } }\r\n{\"productName\":\"林氏木业 实木餐桌椅组合 现代简约 北欧风格\",\"price\":799,\"remark\":\"环保材质,稳固承重\",\"tags\":[\"家具\",\"餐桌\",\"实木\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_005\" } }\r\n{\"productName\":\"小米 智能空调 1.5匹 变频 冷暖 WiFi控制\",\"price\":2699,\"remark\":\"节能静音,智能操控\",\"tags\":[\"家电\",\"空调\",\"智能\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_006\" } }\r\n{\"productName\":\"美的 电风扇 家用落地扇 多功能摇头 静音设计\",\"price\":199,\"remark\":\"夏季降温好帮手\",\"tags\":[\"家电\",\"风扇\",\"家用\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_007\" } }\r\n{\"productName\":\"九阳 破壁机 全自动多功能 加热清洗一键操作\",\"price\":399,\"remark\":\"营养早餐神器\",\"tags\":[\"厨房电器\",\"破壁机\",\"小家电\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_008\" } }\r\n{\"productName\":\"苏泊尔 不粘锅 陶瓷涂层 健康无油烟 家用炒锅\",\"price\":129,\"remark\":\"适合家庭日常使用\",\"tags\":[\"厨房电器\",\"锅具\",\"不粘锅\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_009\" } }\r\n{\"productName\":\"海尔 滚筒洗衣机 10公斤 大容量 智能变频\",\"price\":2499,\"remark\":\"强力洗净,低噪运行\",\"tags\":[\"家电\",\"洗衣机\",\"滚筒\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_010\" } }\r\n{\"productName\":\"奥克斯 电热水器 50升 快速加热 安全防漏电\",\"price\":899,\"remark\":\"浴室安装首选\",\"tags\":[\"家电\",\"热水器\",\"家用\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_011\" } }\r\n{\"productName\":\"索菲亚 衣柜定制 移门设计 现代简约风格\",\"price\":1999,\"remark\":\"空间利用率高\",\"tags\":[\"家具\",\"衣柜\",\"定制\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_012\" } }\r\n{\"productName\":\"顾家家居 L型真皮沙发 客厅豪华转角沙发\",\"price\":3999,\"remark\":\"高端大气,舒适体验\",\"tags\":[\"家具\",\"沙发\",\"真皮\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_013\" } }\r\n{\"productName\":\"宜家 折叠床 单人宿舍用 可收纳 节省空间\",\"price\":399,\"remark\":\"适合学生和租房族\",\"tags\":[\"家具\",\"床\",\"折叠\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_014\" } }\r\n{\"productName\":\"网易严选 记忆棉枕头 高弹透气 护颈设计\",\"price\":79,\"remark\":\"改善睡眠质量\",\"tags\":[\"家居用品\",\"枕头\",\"健康\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_015\" } }\r\n{\"productName\":\"京东京造 羽绒被 子母可拆分 春秋冬三季适用\",\"price\":299,\"remark\":\"保暖舒适,轻盈柔软\",\"tags\":[\"家纺\",\"羽绒被\",\"床上用品\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_016\" } }\r\n{\"productName\":\"喜临门 护脊弹簧床垫 中央弹簧系统 支撑均匀\",\"price\":1499,\"remark\":\"保护脊椎健康\",\"tags\":[\"床垫\",\"护脊\",\"弹簧\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_017\" } }\r\n{\"productName\":\"摩飞 便携式榨汁杯 多功能搅拌 随时随地补充营养\",\"price\":299,\"remark\":\"办公健身都适用\",\"tags\":[\"小家电\",\"榨汁杯\",\"便携\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_018\" } }\r\n{\"productName\":\"北鼎 养生壶 玻璃材质 多种炖煮模式 自动断电\",\"price\":399,\"remark\":\"适合养生人士\",\"tags\":[\"厨房电器\",\"养生壶\",\"热水\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_019\" } }\r\n{\"productName\":\"小狗 吸尘器 无线手持 大吸力 清洁地毯地板\",\"price\":599,\"remark\":\"清洁效率高\",\"tags\":[\"家电\",\"吸尘器\",\"无线\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_020\" } }\r\n{\"productName\":\"戴森 吹风机 智能温控 护发柔顺\",\"price\":2999,\"remark\":\"高端美发工具\",\"tags\":[\"家电\",\"吹风机\",\"护发\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_021\" } }\r\n{\"productName\":\"美的 微波炉 家用多功能 解冻加热 热效率高\",\"price\":499,\"remark\":\"厨房常用电器\",\"tags\":[\"厨房电器\",\"微波炉\",\"家用\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_022\" } }\r\n{\"productName\":\"海信 电视 55寸 4K超高清 智能语音遥控\",\"price\":2499,\"remark\":\"画质清晰,影院级体验\",\"tags\":[\"家电\",\"电视\",\"智能\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_023\" } }\r\n{\"productName\":\"华为 智能音箱 AI语音助手 控制智能家居设备\",\"price\":399,\"remark\":\"打造智慧生活\",\"tags\":[\"智能设备\",\"音箱\",\"语音\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_024\" } }\r\n{\"productName\":\"绿源 电动车 成人通勤 电动自行车 可上牌\",\"price\":2499,\"remark\":\"环保出行新选择\",\"tags\":[\"交通工具\",\"电动车\",\"通勤\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_025\" } }\r\n{\"productName\":\"小米 手机 13旗舰版 骁龙8 Gen2 6400万像素\",\"price\":3999,\"remark\":\"性能强劲,拍照清晰\",\"tags\":[\"手机\",\"数码\",\"旗舰\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_026\" } }\r\n{\"productName\":\"联想 笔记本电脑 ThinkBook 14英寸 商务办公本\",\"price\":5999,\"remark\":\"商务人士首选\",\"tags\":[\"电脑\",\"笔记本\",\"办公\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_027\" } }\r\n{\"productName\":\"佳能 相机 EOS 80D 单反摄影 高清拍摄\",\"price\":6999,\"remark\":\"专业摄影爱好者的首选\",\"tags\":[\"数码\",\"相机\",\"单反\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_028\" } }\r\n{\"productName\":\"飞利浦 电动牙刷 声波震动 智能计时 防水设计\",\"price\":299,\"remark\":\"口腔护理好帮手\",\"tags\":[\"个人护理\",\"牙刷\",\"声波\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_029\" } }\r\n{\"productName\":\"松下 空气净化器 家用除甲醛 PM2.5过滤 强劲风力\",\"price\":1299,\"remark\":\"改善室内空气质量\",\"tags\":[\"家电\",\"空气净化器\",\"除甲醛\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_030\" } }\r\n{\"productName\":\"美的 电饭煲 IH电磁加热 智能预约 多功能菜单\",\"price\":399,\"remark\":\"智能烹饪更方便\",\"tags\":[\"厨房电器\",\"电饭煲\",\"IH\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_031\" } }\r\n{\"productName\":\"九阳 电压力锅 一键排气 安全耐用 多功能烹饪\",\"price\":299,\"remark\":\"节省时间提高效率\",\"tags\":[\"厨房电器\",\"压力锅\",\"多功能\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_032\" } }\r\n{\"productName\":\"德尔玛 加湿器 小型桌面 USB供电 静音设计\",\"price\":79,\"remark\":\"冬季保湿必备\",\"tags\":[\"家电\",\"加湿器\",\"静音\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_033\" } }\r\n{\"productName\":\"美的 风扇暖风机 冬季取暖 快速升温 安全防护\",\"price\":149,\"remark\":\"适合局部供暖\",\"tags\":[\"家电\",\"暖风机\",\"取暖\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_034\" } }\r\n{\"productName\":\"雷士 灯具 LED吸顶灯 现代简约 客厅卧室通用\",\"price\":199,\"remark\":\"光线柔和不刺眼\",\"tags\":[\"灯具\",\"LED\",\"吸顶灯\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_035\" } }\r\n{\"productName\":\"公牛 插座 多功能USB插排 过载保护 安全可靠\",\"price\":49,\"remark\":\"家庭用电安全助手\",\"tags\":[\"配件\",\"插座\",\"USB\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_036\" } }\r\n{\"productName\":\"得力 办公桌 电脑桌 人体工学设计 可调节高度\",\"price\":399,\"remark\":\"提升工作效率\",\"tags\":[\"办公家具\",\"桌子\",\"电脑桌\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_037\" } }\r\n{\"productName\":\"晨光 文具套装 礼盒装 多功能学习办公用品集合\",\"price\":89,\"remark\":\"送礼自用两相宜\",\"tags\":[\"文具\",\"办公\",\"学习\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_038\" } }\r\n{\"productName\":\"乐高 积木玩具 儿童益智拼搭 教育启蒙玩具\",\"price\":299,\"remark\":\"培养动手能力\",\"tags\":[\"玩具\",\"儿童\",\"积木\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_039\" } }\r\n{\"productName\":\"迪士尼 儿童书包 幼儿园卡通可爱 多口袋设计\",\"price\":129,\"remark\":\"上学背书好伴侣\",\"tags\":[\"母婴\",\"书包\",\"儿童\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_040\" } }\r\n{\"productName\":\"babycare 婴儿推车 可折叠 超轻便携 新生儿适用\",\"price\":699,\"remark\":\"带娃出行利器\",\"tags\":[\"母婴\",\"推车\",\"婴儿\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_041\" } }\r\n{\"productName\":\"惠氏 婴儿奶粉 一段 900g 营养均衡\",\"price\":249,\"remark\":\"宝宝成长好伙伴\",\"tags\":[\"母婴\",\"奶粉\",\"婴儿食品\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_042\" } }\r\n{\"productName\":\"贝亲 奶瓶 PP材质 宽口径 容易清洗\",\"price\":59,\"remark\":\"新生儿专用奶瓶\",\"tags\":[\"母婴\",\"奶瓶\",\"PP材质\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_043\" } }\r\n{\"productName\":\"安踏 运动鞋 男款跑步鞋 缓震耐磨 透气网面\",\"price\":299,\"remark\":\"适合日常运动穿着\",\"tags\":[\"运动\",\"鞋子\",\"缓震\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_044\" } }\r\n{\"productName\":\"李宁 运动T恤 透气速干 吸汗排湿 适合健身\",\"price\":129,\"remark\":\"健身房穿搭推荐\",\"tags\":[\"运动\",\"T恤\",\"健身\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_045\" } }\r\n{\"productName\":\"Keep 智能跳绳 计数蓝牙连接 APP同步训练数据\",\"price\":99,\"remark\":\"科学锻炼好工具\",\"tags\":[\"运动\",\"跳绳\",\"智能\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_046\" } }\r\n{\"productName\":\"迪卡侬 健身哑铃 可调节重量 初学者适用\",\"price\":149,\"remark\":\"家庭健身器材推荐\",\"tags\":[\"运动\",\"哑铃\",\"健身\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_047\" } }\r\n{\"productName\":\"耐克 运动背包 多功能分区 防水耐磨 舒适背垫\",\"price\":299,\"remark\":\"运动与通勤兼顾\",\"tags\":[\"运动\",\"背包\",\"防水\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_048\" } }\r\n{\"productName\":\"阿迪达斯 运动裤 休闲宽松 适合跑步和日常穿着\",\"price\":199,\"remark\":\"舒适有型,百搭款式\",\"tags\":[\"运动\",\"裤子\",\"休闲\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_049\" } }\r\n{\"productName\":\"Under Armour 男士紧身衣 压缩型 保持肌肉稳定\",\"price\":399,\"remark\":\"高强度训练必备\",\"tags\":[\"运动\",\"紧身衣\",\"压缩\"]}\r\n{ \"index\": { \"_index\": \"product_index\", \"_id\": \"product_050\" } }\r\n{\"productName\":\"Speedo 泳镜 防雾防水 高透镜片 适合泳池使用\",\"price\":89,\"remark\":\"游泳必备装备\",\"tags\":[\"运动\",\"泳镜\",\"防水\"]}\r\n",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/_bulk",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "_bulk"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "创建时PIT快照",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_pit?keep_alive=1m",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_pit"
                    ],
                    "query": [
                        {
                            "key": "keep_alive",
                            "value": "1m"
                        }
                    ]
                }
            },
            "response": []
        },
        {
            "name": "测试PIT删除数据",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "DELETE",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_doc/product_001",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_doc",
                        "product_001"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "测试PIT修改数据",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"productName\": \"公牛 插座 多功能USB插排 过载保护 安全可靠 测试修改\",\r\n    \"price\": 49,\r\n    \"remark\": \"家庭用电安全助手\",\r\n    \"tags\": [\r\n        \"配件\",\r\n        \"插座\",\r\n        \"USB\"\r\n    ]\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_doc/product_035",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_doc",
                        "product_035"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "PIT搜索",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"pit\": {\r\n        \"id\": \"p66xAwMNcHJvZHVjdF9pbmRleBZuNUhaTFFxclNIR2F4enJkZUc4cnh3ARZoRF9oc0R6SVRUNjQtcHZOS1pfUjhRAAAAAAACNG3YFnFzdDRyTUh4U1BpaWRWRmNMVzBEb1ENcHJvZHVjdF9pbmRleBZuNUhaTFFxclNIR2F4enJkZUc4cnh3AhZoRF9oc0R6SVRUNjQtcHZOS1pfUjhRAAAAAAACNG3ZFnFzdDRyTUh4U1BpaWRWRmNMVzBEb1ENcHJvZHVjdF9pbmRleBZuNUhaTFFxclNIR2F4enJkZUc4cnh3ABZoRF9oc0R6SVRUNjQtcHZOS1pfUjhRAAAAAAACNG3XFnFzdDRyTUh4U1BpaWRWRmNMVzBEb1EBFm41SFpMUXFyU0hHYXh6cmRlRzhyeHcAAA==\",\r\n        \"keep_alive\": \"1m\"\r\n    },\r\n    \"size\": 60,\r\n    \"query\": {\r\n        \"match_all\": {}\r\n    },\r\n    \"sort\": [\r\n        {\r\n            \"price\": \"asc\"\r\n        }\r\n    ]\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/_search",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "【检索】模拟分页超出限制",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n  \"from\": 0,\r\n  \"size\": 20,\r\n  \"sort\": [\r\n        {\r\n            \"price\": \"asc\"\r\n        }\r\n    ]\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_search",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "修改分页限制",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "PUT",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n  \"settings\": {\r\n    \"max_result_window\": 50000\r\n  }\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_settings",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_settings"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "【检索】search_after搜索",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"size\":10,\r\n    \"query\":{\r\n        \"match_all\":{}\r\n    },\r\n    \"sort\":[\r\n       {\"price\": \"asc\"}\r\n    ],\r\n    \"search_after\":[\r\n        49.0\r\n    ],\r\n    \"track_total_hits\":false\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_search",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_search"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "【检索】开启scroll搜索",
            "protocolProfileBehavior": {
                "disableBodyPruning": true
            },
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "GET",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n    \"size\":10,\r\n    \"query\":{\r\n        \"match_all\":{}\r\n    },\r\n    \"sort\":[\r\n       {\"price\": \"asc\"}\r\n    ]\r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/product_index/_search?scroll=1m",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "product_index",
                        "_search"
                    ],
                    "query": [
                        {
                            "key": "scroll",
                            "value": "1m"
                        }
                    ]
                }
            },
            "response": []
        },
        {
            "name": "【检索】下一页scroll搜索",
            "request": {
                "auth": {
                    "type": "noauth"
                },
                "method": "DELETE",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\r\n  \"scroll\" : \"1m\",                                                                 \r\n  \"scroll_id\" : \"FGluY2x1ZGVfY29udGV4dF91dWlkDnF1ZXJ5VGhlbkZldGNoAxZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbcWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbYWaERfaHNEeklUVDY0LXB2TktaX1I4URZxc3Q0ck1IeFNQaWlkVkZjTFcwRG9RAAAAAAI0cbgWaERfaHNEeklUVDY0LXB2TktaX1I4UQ==\" \r\n}",
                    "options": {
                        "raw": {
                            "language": "json"
                        }
                    }
                },
                "url": {
                    "raw": "10.4.3.230:9200/_search/scroll",
                    "host": [
                        "10",
                        "4",
                        "3",
                        "230"
                    ],
                    "port": "9200",
                    "path": [
                        "_search",
                        "scroll"
                    ]
                }
            },
            "response": []
        }
    ]
}
View Code

 

posted @ 2025-03-08 19:57  意犹未尽  阅读(85)  评论(0)    收藏  举报