Downloading the Version of an Asset through Search API is not working in Nexus 3.38.1-01


I’ve tried to to download the version of the asset through Search API in Nexus 3.38.1-01.
I’m getting a different archive with every call to the REST API when using the version filter:

curl -u user:password -X GET "https://repository.domain/service/rest/v1/search/assets/download?sort=version&repository=repository&maven.groupId=group&maven.artifactId=artifact&maven.extension=zip&maven.baseVersion=version" -H "accept: application/json" -o -fsSLg --max-redirs 5

No errors in nexus.log, just downloaded different archive than I requested.
Everything was working in Nexus 3.34.0-01.

Try rebuilding the elasticsearch indexes. Go to “system → tasks”, and create and run a task of type “repair: rebuild repository search” against the repository.