Once elastic/elasticsearch#35849 is merged the format of hits.total as returned by Elasticsearch will change. We need to cater for that, since we read out hits.total in some places.
The way we are planning to do this is the following:
- Step 1: Add
rest_total_hits_as_int=true to all requests, that we need to get hits.total from in the end. This will cause the API to return the old format for requests, where nothing changed. Since this parameter is available since 6.6, we can backport that change to the 6.x branch.
- Step 2: Once we don't have much work going on on the
6.x branch anymore (after 7.0 release), adopt all places that are consuming hits.total to the new format, and switch over the parameter to use track_total_hits=true instead to get the exact result in all those requests.
- Step 3: Analyze if there are any places where we don't need the exact matches and could potentially replace this by showing the estimated hits as with the new behavior.
We are going this way, since that allows us to have master and 6.x branch in sync before the 7.0 release. If we would directly switch to the new format, we can't backport this change to 6.x and thus master and 6.x will have a different state in all the places we are accessing hits.total and are executing a query. Since this will make backporting future changes to 6.x more difficult we won't change to the new format as long as we are still actively developing features on 6.x.
Since the rest_total_hits_as_int parameter is scheduled for removal in 8.0, I will directly mark this issue as a blocker for 8.0 as a reminder, that step 2 needs to be implemented till then.
When this is completed, we can remove the temporary shim that was introduced as part of #61565.
Related issues/PRs
CC
Since I did a quick search through the repository for hits.total it seems the following teams are effected and might establish a similar progress for moving over.
cc @elastic/kibana-platform used in es_archiver and saved objects
cc @elastic/apm-ui Used in a couple of places
cc @elastic/ml-ui Used in a couple of places
cc @elastic/kibana-management (I couldn't find a handle for elasticsearch UI yet): used in watcher
cc whoever manages Stack monitoring
Once elastic/elasticsearch#35849 is merged the format of
hits.totalas returned by Elasticsearch will change. We need to cater for that, since we read outhits.totalin some places.The way we are planning to do this is the following:
rest_total_hits_as_int=trueto all requests, that we need to gethits.totalfrom in the end. This will cause the API to return the old format for requests, where nothing changed. Since this parameter is available since 6.6, we can backport that change to the6.xbranch.6.xbranch anymore (after 7.0 release), adopt all places that are consuminghits.totalto the new format, and switch over the parameter to usetrack_total_hits=trueinstead to get the exact result in all those requests.We are going this way, since that allows us to have
masterand6.xbranch in sync before the 7.0 release. If we would directly switch to the new format, we can't backport this change to6.xand thusmasterand6.xwill have a different state in all the places we are accessinghits.totaland are executing a query. Since this will make backporting future changes to6.xmore difficult we won't change to the new format as long as we are still actively developing features on6.x.Since the
rest_total_hits_as_intparameter is scheduled for removal in 8.0, I will directly mark this issue as a blocker for 8.0 as a reminder, that step 2 needs to be implemented till then.When this is completed, we can remove the temporary shim that was introduced as part of #61565.
Related issues/PRs
CC
Since I did a quick search through the repository for
hits.totalit seems the following teams are effected and might establish a similar progress for moving over.cc @elastic/kibana-platform used in es_archiver and saved objects
cc @elastic/apm-ui Used in a couple of places
cc @elastic/ml-ui Used in a couple of places
cc @elastic/kibana-management (I couldn't find a handle for elasticsearch UI yet): used in watcher
cc whoever manages Stack monitoring