I have a simple setup with a green cluster (v7.5.2) of 1 instance with 1 index (replica 0) with 8 shards.
61,500 documents indexed.
If I create 8 slices with these queries (POST queries)
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]
Only 1 slice has results which is equivalent to not slicing the index in the first place.
I tried a max of 32 with those commands:
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]
This way I can scroll my index using 4 different (non-empty) slices but I had to create 32 contexts which is not ideal.
What am I doing wrong?
I tried to use a date as slice.field
"slice": {
"field": "created_at",
but it did not help.