GuidesAPI Reference
Guides

How to use part queries


You can use part queries to run multiple queries in parallel, which can save time and reduce the likelihood of timeouts, network errors, and other system errors.

Get parts

To perform part queries, you must first send a getParts request. A sample request is below.

GET /<Base path for the index API from the API Lookup Service>/layers/<Layer ID>/parts?numRequestedParts=<Positive Integer> HTTP/1.1

The following is an example response:

{
    "parts": [
        {
            "partId": "eyJ0aW1lc3RhbXAiOjE1ODY4ODQxNDAsIm51bVJhbmdlcyI6NSwic3RhcnRVVUlEIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwiZW5kVVVJRCI6IjNmZmZmZmZmLWZmZmYtZmZmZi1mZmZmLWZmZmZmZmZmZmZmZiJ9"
        },
        {
            "partId": "eyJ0aW1lc3RhbXAiOjE1ODY4ODQxNDAsIm51bVJhbmdlcyI6NSwic3RhcnRVVUlEIjoiM2ZmZmZmZmYtZmZmZi1mZmZmLWZmZmYtZmZmZmZmZmZmZmZmIiwiZW5kVVVJRCI6IjdmZmZmZmZmLWZmZmYtZmZmZi1mZmZmLWZmZmZmZmZmZmZmZSJ9"
        },
        {
            "partId": "eyJ0aW1lc3RhbXAiOjE1ODY4ODQxNDAsIm51bVJhbmdlcyI6NSwic3RhcnRVVUlEIjoiN2ZmZmZmZmYtZmZmZi1mZmZmLWZmZmYtZmZmZmZmZmZmZmZlIiwiZW5kVVVJRCI6ImJmZmZmZmZmLWZmZmYtZmZmZi1mZmZmLWZmZmZmZmZmZmZmZCJ9"
        },
        {
            "partId": "eyJ0aW1lc3RhbXAiOjE1ODY4ODQxNDAsIm51bVJhbmdlcyI6NSwic3RhcnRVVUlEIjoiYmZmZmZmZmYtZmZmZi1mZmZmLWZmZmYtZmZmZmZmZmZmZmZkIiwiZW5kVVVJRCI6ImZmZmZmZmZmLWZmZmYtZmZmZi1mZmZmLWZmZmZmZmZmZmZmZiJ9"
        }
    ]
}
📘

Note

You can execute multiple part queries in a distributed cluster, such as with Apache Spark. The combined results are consistent and reflect the snapshot at a single point of time.

The numRequestedParts parameter in the request must be a positive integer.

If the layer you query contains a small amount of data, the actual number of partId values returned may be less than numRequestedParts.

Query parts

Once you get the partId, you can query each part using the following format:

GET /<Base path for the index API from the API Lookup Service>/layers/<Layer ID>?query=<RSQL>&part=<partId> HTTP/1.1
📘

Note

The query must be performed within two hours of the partId values being generated.