iQ Suite - Docs
SDK ReferenceDocument RAG

Create Index with Polling

Create a new searchable index by uploading a document and wait for the process to complete using polling.

Description

The Create Index With Polling endpoint allows you to create a new searchable index by uploading a document and automatically monitor the indexing process until completion. Supported file types include PDF, DOC, DOCX, PPT, PPTX with a maximum file size of 20MB.

Caution

Create Index With Polling with polling is an synchronous process and it'll run until the index creation is completed and it can take upto 300 seconds to complete depending upon the size of the uploaded file.

It's recommended to use our Webhooks or putting this method inside an async queue.

Request Example

try:
    # Open the file in binary mode
    with open('document.pdf', 'rb') as file:
        # Initiate index creation and wait for it to complete
        response, status = client.create_index_and_poll(
            document=file,          # Pass the binary file object
            filename='document.pdf',# Provide the filename
            poll_interval=20,       # Time in seconds between each poll
            max_retries=10          # Maximum number of polling attempts
        )
    # Print the Index ID once creation is complete
    print(f"Index ID: {response.data.task_id}")
except APIError as e:
    print(f"An error occurred: {e}")

Need Help?

On this page