Search using search api sometimes results in empty responses

Hello.
I have a question about a problem I am having with the search api on nexus 3.

When using the search api on sonatype nexus 3 and performing a command line search as follows, the results may be empty even though the file exists on nexus.

curl -u : https://<nexus’s domain>/service/rest/v1/search/assets?repository=&group=<group_name>&q=<query_keyword>

Example response on success:.
{
“items” : [ {
“downloadUrl” : "https://<nexus’s domain>/repository/<repository_name>/<group_name>/<module_name>,
“path” : “<group_name>/<module_name>”,
“id” : “bGNpLXN0YXItYXBpLXJhdy1yZWxlYXNlOjJlMjBkODc0YWIxM2YwZDI5ZTU4N2JkOWM4NzE5MTUx”,
“repository” : “<repository_name>”,
“format” : “raw”,
“checksum” : {
“sha1” : “8007fe3734db3d67b9f95e41071af79bff28d637”,
“md5” : “c9bcc0b3359b6bd1ba6a376ebe77e64b”
}
} ],
“continuationToken” : null
}

Example response when empty:.
{
“items” : [ ],
“continuationToken” : null
}

If the response is empty, after logging in to nexus and downloading that file from the screen (GUI), the search results on the command line will respond correctly.

I am having trouble finding the cause of this problem. Can anyone give me some advice on this?
Has anyone ever experienced a similar event?

Is it a proxy repository? Nexus REST API (and UI) only includes content on the server.

Thank you for your comment.
It is a raw repository, not a proxy repository.

You mean it’s a raw hosted repository? You can still have raw proxy repositories.

Yes, it’s a raw hosted repository.
If the search for a file fails, after logging into nexus and downloading that file on the screen, the search for the file will succeed.
Based on the above facts, we suspect that there is a time lag until the elasticsearch index is generated, or there is some other event that is causing the failure.

The search index is updated asynchronously and may take several seconds.

Thank you for your response.
Sometimes the response is null after a few hours or so, not a few seconds.
If you could advise us of any log information that we should investigate, we would be very grateful.

We had the exact same reproducible issue after restarting our Nexus 3.38.1 instance, so thanks for posting this.

We updated our container instance to 3.43.0. Upon startup of the container the log was full of updating index messages. Once they completed all of our searches brought back a full set of results again.