Skip to content

start_index_rebuild

start_index_rebuild(
    *,
    config_overrides: Optional[neptunedataClientConfig] = None,
    scope: Optional[Scope] = None,
    concurrency: Optional[RebuildConcurrency] = None,
    write_buffer_size: Optional[WriteBufferSize] = None,
    client_token: Optional[str] = None,
) -> StartIndexRebuildOutput

Initiates an index rebuild operation to optimize storage and improve query performance. The rebuild operation reorganizes index to reclaim space and improve efficiency.

When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that allows the neptune-db:StartIndexRebuild IAM action in that cluster.

Parameters:

  • scope (Optional[Scope], default: None ) –

    Specifies the scope of the rebuild operation. Possible values are:

    • ALL - Rebuild all (quads and dictionaries). This is the default if not specified.

    • QUADS - Rebuild only the quad indexes.

    • DICTIONARIES - Rebuild only the dictionaries.

  • concurrency (Optional[RebuildConcurrency], default: None ) –

    The number of concurrent indexes to rebuild in parallel. If not specified, defaults to 1.

    Valid values are between 1 and the number of vCPUs available on the writer instance. If the value exceeds the available vCPUs, it is capped at the maximum instead of returning an InvalidParameterException. The effective (capped) value is returned in the response.

    Higher concurrency can shorten the overall rebuild, but also increases CPU and I/O load during the operation.

  • write_buffer_size (Optional[WriteBufferSize], default: None ) –

    Controls the buffer size used for tracking concurrent write operations during the index rebuild. If your database has high write traffic during the rebuild, a larger buffer prevents the operation from failing due to buffer overflow. Possible values are:

    • LOW - Suitable for databases with light to moderate write activity. This is the default.

    • MEDIUM - Recommended for databases with sustained write traffic or bulk loading.

    • HIGH - Use when rebuilding indexes during heavy write workloads or continuous bulk data ingestion.

    If your rebuild fails and you are actively writing data to the database, retry with a higher writeBufferSize value. For bulk load operations, consider using HIGH.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, the SDK automatically generates one.

Raises:

Source code in docs_src/capo_neptunedata/_services/neptunedata.py
def start_index_rebuild(
    self,
    *,
    config_overrides: Optional[neptunedataClientConfig] = None,
    scope: Optional["capo_neptunedata.types.scope.Scope"] = None,
    concurrency: Optional[
        "capo_neptunedata.types.rebuild_concurrency.RebuildConcurrency"
    ] = None,
    write_buffer_size: Optional[
        "capo_neptunedata.types.write_buffer_size.WriteBufferSize"
    ] = None,
    client_token: Optional[str] = None,
) -> "capo_neptunedata.types.start_index_rebuild_output.StartIndexRebuildOutput":
    """<p>Initiates an index rebuild operation to optimize storage and improve query performance. The rebuild operation reorganizes index to reclaim space and improve efficiency.</p> <p>When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that allows the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#startindexrebuild">neptune-db:StartIndexRebuild</a> IAM action in that cluster.</p>

    Args:
        scope: <p>Specifies the scope of the rebuild operation. Possible values are:</p> <ul> <li> <p> <code>ALL</code> - Rebuild all (quads and dictionaries). This is the default if not specified.</p> </li> <li> <p> <code>QUADS</code> - Rebuild only the quad indexes. </p> </li> <li> <p> <code>DICTIONARIES</code> - Rebuild only the dictionaries.</p> </li> </ul>
        concurrency: <p>The number of concurrent indexes to rebuild in parallel. If not specified, defaults to <code>1</code>.</p> <p>Valid values are between <code>1</code> and the number of vCPUs available on the writer instance. If the value exceeds the available vCPUs, it is capped at the maximum instead of returning an <code>InvalidParameterException</code>. The effective (capped) value is returned in the response.</p> <p>Higher concurrency can shorten the overall rebuild, but also increases CPU and I/O load during the operation.</p>
        write_buffer_size: <p>Controls the buffer size used for tracking concurrent write operations during the index rebuild. If your database has high write traffic during the rebuild, a larger buffer prevents the operation from failing due to buffer overflow. Possible values are:</p> <ul> <li> <p> <code>LOW</code> - Suitable for databases with light to moderate write activity. This is the default.</p> </li> <li> <p> <code>MEDIUM</code> - Recommended for databases with sustained write traffic or bulk loading.</p> </li> <li> <p> <code>HIGH</code> - Use when rebuilding indexes during heavy write workloads or continuous bulk data ingestion.</p> </li> </ul> <p>If your rebuild fails and you are actively writing data to the database, retry with a higher <code>writeBufferSize</code> value. For bulk load operations, consider using <code>HIGH</code>.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, the SDK automatically generates one.</p>

    Raises:
        capo_neptunedata.errors.access_denied_exception.AccessDeniedException: <p>Raised in case of an authentication or authorization failure.</p>
        capo_neptunedata.errors.client_timeout_exception.ClientTimeoutException: <p>Raised when a request timed out in the client.</p>
        capo_neptunedata.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Raised when a request attempts to modify data that is concurrently being modified by another process.</p>
        capo_neptunedata.errors.constraint_violation_exception.ConstraintViolationException: <p>Raised when a value in a request field did not satisfy required constraints.</p>
        capo_neptunedata.errors.illegal_argument_exception.IllegalArgumentException: <p>Raised when an argument in a request is not supported.</p>
        capo_neptunedata.errors.internal_failure_exception.InternalFailureException: <p>Raised when the processing of the request failed unexpectedly.</p>
        capo_neptunedata.errors.invalid_argument_exception.InvalidArgumentException: <p>Raised when an argument in a request has an invalid value.</p>
        capo_neptunedata.errors.invalid_parameter_exception.InvalidParameterException: <p>Raised when a parameter value is not valid.</p>
        capo_neptunedata.errors.memory_limit_exceeded_exception.MemoryLimitExceededException: <p>Raised when a request fails because of insufficient memory resources. The request can be retried.</p>
        capo_neptunedata.errors.method_not_allowed_exception.MethodNotAllowedException: <p>Raised when the HTTP method used by a request is not supported by the endpoint being used.</p>
        capo_neptunedata.errors.preconditions_failed_exception.PreconditionsFailedException: <p>Raised when a precondition for processing a request is not satisfied.</p>
        capo_neptunedata.errors.read_only_violation_exception.ReadOnlyViolationException: <p>Raised when a request attempts to write to a read-only resource.</p>
        capo_neptunedata.errors.resource_not_found_exception.ResourceNotFoundException: <p>Raised when the specified resource could not be found. The resource might have been deleted or the identifier might be incorrect.</p>
        capo_neptunedata.errors.server_shutdown_exception.ServerShutdownException: <p>Raised when the server shuts down while processing a request.</p>
        capo_neptunedata.errors.too_many_requests_exception.TooManyRequestsException: <p>Raised when the number of requests being processed exceeds the limit.</p>
        capo_neptunedata.errors.unsupported_operation_exception.UnsupportedOperationException: <p>Raised when a request attempts to initiate an operation that is not supported.</p>
        capo_neptunedata.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_neptunedata.types.start_index_rebuild_input.StartIndexRebuildInput]",
    ) -> OperationResponse[
        "capo_neptunedata.types.start_index_rebuild_output.StartIndexRebuildOutput"
    ]:
        import capo_neptunedata._operations.amazon_neptune_dataplane.start_index_rebuild

        output, http_response = (
            capo_neptunedata._operations.amazon_neptune_dataplane.start_index_rebuild.start_index_rebuild(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartIndexRebuild")
    )
    input_: capo_neptunedata.types.start_index_rebuild_input.StartIndexRebuildInput = {}
    if scope is not None:
        input_["scope"] = scope
    if concurrency is not None:
        input_["concurrency"] = concurrency
    if write_buffer_size is not None:
        input_["write_buffer_size"] = write_buffer_size
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output