Problem with getting all assets from the npm group - Sonatype Nexus Repository - Sonatype Community
Problem with getting all assets from the npm group
post by Vasai_Yan on Jan 30, 2025
Hello. I want to download all assets from a certain repository and certain groups (not all). To get a list of all assets in a group, I use the following parameters:
GET {{BASE_URL}}/service/rest/v1/search/assets
?repository=myrepository
&group=npm-group-1
&sort=name
This query returns me a list of assets, pagination by continuationToken, which I use in the next query. After getting 10k-15k assets, I get an empty continuationToken while processing 30-40 packets, even though there are about 100 in the group and the total number of assets is 50k+.
Can you please tell me how I can get a list of all assets from a specific repository and a specific group?
Nexus Repository - 3.70.3-01
post by jboss-04 on Jan 31, 2025
I did not try this, but Sonatype decided to make external keys stored in the index and the index is easy to corrupt. Last time I noticed that when I did staging delete operation, the records stayed in the index despite the artifacts were properly deleted.
If I were you, I would try to repair indexes and try again. It helped me many times.
post by Vasai_Yan on Jan 31, 2025
Thanks so much for the advice!
Could you please tell me how to clean the indexes correctly, so as not to delete the necessary ones? If you share the documentation I would be very grateful.
post by jboss-04 on Jan 31, 2025
Schedule the task in the Tasks.
post by mpiggott on Jan 31, 2025
Its been a while since I looked at ES internals but from what I recall the pagination relies on some in-memory caching which can be expired. It would make sense to use the Asset API as opposed to the search endpoint, although you would need to do it by repository member as opposed to group: Assets API