LogoLogo
  • API Service Gateway Overview
    • Introduction
    • Getting Started with the APIs
    • Using your API key
    • API Rate Limiting
    • API Service Gateway Responses
  • Elasticsearch Metadata Services
    • Resource Information Network (RIN) Services
      • Research Resource Identifiers
      • The RRID Resolver
      • Searching RIN Indices
      • Basic RIN Search Examples
      • RIN Elaticsearch JSON Data Model
      • Download Larger Datasets
    • SPARC Datasets
      • Searching SPARC Dataset Indices
      • Basic SPARC Search Examples
      • SPARC Dataset Elasticsearch JSON Data Model
  • Terminology Services
    • InterLex
      • Searching InterLex
      • Basic Interlex Search Example
      • Bulk Add
      • Bulk Update
Powered by GitBook
On this page
Edit on GitHub
Export as PDF
  1. Elasticsearch Metadata Services
  2. Resource Information Network (RIN) Services

Download Larger Datasets

PreviousRIN Elaticsearch JSON Data ModelNextSPARC Datasets

Last updated 3 months ago

If you are new to our API service, we recommend starting with “” and “” for helpful guidance first. If you have any questions, please do not hesitate to contact us. With a large number of records to download you would not be able to do that via a simple Elasticsearch search as Elasticsearch's paging limit is 10,000 records. Therefore, you need to use Elasticsearch's scroll mechanism. An example of such a curl request would be (Note: for normal queries you would not add the ?scroll=1s to the end): Initialize Download of an Entire Index To download an entire index from the API, you start the scrolling process with the following curl command:

curl --location 'https://api.scicrunch.io/elastic/v1/<<YOUR<https://api.scicrunch.io/elastic/v1/%3C%3CYOUR> TARGET INDEX>>/_search?scroll=1s' \ --header 'Content-Type: application/json' \ --header 'apikey: <<YOUR API KEY>>' \ --data '{ <<YOUR QUERY HERE>> }' Make sure to replace the placeholders:

<<YOUR TARGET INDEX>> with the index you're targeting.

<<YOUR API KEY>> with your API key.

<<YOUR QUERY HERE>> with the specific query you want to execute.

For example queries, refer to the following link:.

Page Through Index and Download Content

The initial scroll query would yield results such as: { "_scroll_id": "DnF1ZXJ5VGhlbkZldGNoAgAAAAAF-0fRFkhYNzFBb1loU1dLbVpicWpmSTl3b1EAAAAABftH0hZIWDcxQW9ZaFNXS21aYnFqZkk5d29R", "took": 19, "timed_out": false, "_shards": { "total": 2, "successful": 2, "skipped": 0, "failed": 0 }, "hits": { ... To download additional content you would need to download the next set of results. To do this, use the scroll_id from the prior result and create a new request: curl --location 'https://api.scicrunch.io/elastic/v1/_search/scroll' \ --header 'Content-Type: application/json' \ --header 'apikey: <<YOUR API KEY>>' \ --data '{ "scroll" : "1s", "scroll_id" : "DnF1ZXJ5VGhlbkZldGNoAgAAAAAF-0fRFkhYNzFBb1loU1dLbVpicWpmSTl3b1EAAAAABftH0hZIWDcxQW9ZaFNXS21aYnFqZkk5d29R" }' This will generate a set of results with a new scroll_id. Use this new scroll_id to generate a new request and repeat...

Getting Started with the APIs
Using your API key
Example Queries