I am trying to improve queries in one index with ~ 125 million documents and 3 shards. Most of the queries hitting this index have a sort order for a given field with values ascending and descending.
Currently the index settings are the following:
{
"joao-2023-03-08_2" : {
"settings" : {
"index" : {
"refresh_interval" : "60s",
"number_of_shards" : "3",
"provided_name" : "joao-2023-03-08_2",
"creation_date" : "1678304042926",
"sort" : {
"field" : "a_field" ,
"order" : "asc"
},
"number_of_replicas" : "1",
"uuid" : "0-8O_yOYQ_iAxC2UUpaJGB",
"version" : {
"created" : "135248027"
}
}
}
}
}
The queries with sort a_field=desc are slow. I know it is possible to modify the configuration and pass the same field (a_field) in the array with the desc value. Doing this does not seem correct, but I am not sure how internally the segments will be created.
Is there anything I could read or do to improve this scenario?
Thanks in advance!