> For the complete documentation index, see [llms.txt](https://docs.scicrunch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scicrunch.io/elasticsearch-metadata-services/resource-information-network-rin-services/download-larger-datasets.md).

# Download Larger Datasets

If you are new to our API service, we recommend starting with “[Getting Started with the APIs](/api-service-gateway-overview/getting-started-with-sparc-apis.md)” and “[Using your API key](/api-service-gateway-overview/using-your-api-key.md)” 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. \
\
**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 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:[ Example Queries](/elasticsearch-metadata-services/resource-information-network-rin-services/basic-rin-search-examples.md).

<br>

**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...


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.scicrunch.io/elasticsearch-metadata-services/resource-information-network-rin-services/download-larger-datasets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
