简体   繁体   English

Elasticsearch:使用带有切片的滚动 api 时为空切片

[英]Elasticsearch: empty slices when using scroll api with slice

I have a simple setup with a green cluster (v7.5.2) of 1 instance with 1 index (replica 0) with 8 shards.我有一个简单的设置,其中包含 1 个实例的绿色集群(v7.5.2)和 1 个索引(副本 0)和 8 个分片。 61,500 documents indexed.索引了 61,500 个文档。

If I create 8 slices with these queries (POST queries)如果我使用这些查询创建 8 个切片(POST 查询)

http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 0, 'max': 8}, 'size': 1000}
http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 1, 'max': 8}, 'size': 1000}
...
http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 7, 'max': 8}, 'size': 1000}

for each slice I collect the first hits of each slice and get those lengths: [1000, 0, 0, 0, 0, 0, 0, 0]对于每个切片,我收集每个切片的第一个命中并获得这些长度: [1000, 0, 0, 0, 0, 0, 0, 0]

Only 1 slice has results which is equivalent to not slicing the index in the first place.只有 1 个切片有结果,这相当于首先不切片索引。

I tried a max of 32 with those commands:我用这些命令最多尝试了 32 个:

http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 0, 'max': 32}, 'size': 1000}
http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 1, 'max': 32}, 'size': 1000}
...
http://localhost:9202/products_dev/_search?scroll=10m: {'slice': {'field': 'created_at', 'id': 31, 'max': 32}, 'size': 1000}

for each slice I collect the first hits of each slice and get those lengths: [1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0]对于每个切片,我收集每个切片的第一个命中并获得这些长度: [1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0]

This way I can scroll my index using 4 different (non-empty) slices but I had to create 32 contexts which is not ideal.这样我可以使用 4 个不同的(非空)切片滚动我的索引,但我必须创建 32 个不理想的上下文。

What am I doing wrong?我究竟做错了什么?

I tried to use a date as slice.field我尝试使用日期作为 slice.field

"slice": {
        "field": "created_at",

but it did not help.但它没有帮助。

My local index had so few documents, most of the documents where saved in 1 shard我的本地索引文件很少,大部分文件保存在 1 个分片中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM