# How to re-index unsealed pieces that are flagged by LID in Boost v2

As explained in the tutorial [how to upgrade from Boost v1 to Boost v2](/tutorials/how-to-migrate-boost-v1-to-boost-v2.md), in Boost v2 the Local Index Directory periodically checks all pieces that the SP stores and confirms if there exists an *unsealed copy* of the data and whether it is *indexed*. If the index is missing, the piece is *flagged*, meaning that the operator of the SP should fix it if they wish to make it retrievable.

<figure><img src="/files/9eWmxPJfEGnzd2JzMLLL" alt=""><figcaption></figcaption></figure>

Fixing individual flagged unsealed pieces from the Boost Web UI is possible directly from the Web UI.

If the SP has a lot of flagged pieces, you can automate the re-indexing of pieces with the following commands:

#### Fetch the `piececid`s of all the flagged unsealed pieces from LID

{% code overflow="wrap" %}

```
// GraphQL query to get the first 100 flagged unsealed pieces from LID.
// If you have more than 100 flagged unsealed pieces, you need to modify the query
// and adjust the pagination parameters

curl -X POST -H "Content-Type: application/json" -d '{"query":"query { piecesFlagged(hasUnsealedCopy: true, limit: 100) { totalCount pieces { CreatedAt PieceCid IndexStatus { Status Error } } } }" }' http://localhost:8080/graphql/query | jq -r ".data.piecesFlagged.pieces[] | .PieceCid"
```

{% endcode %}

#### Trigger re-indexing of each `piececid`

```
// Re-index a specific piececid.
// Assumes that the piececid has an unsealed copy.

boostd lid gen-index <piececid>
```

#### Automatically re-index marked pieces only

This little script will fetch up to a thousand flagged pieces that are not processed yet, and will process them 4 at a time. Change the -P4 parameter to change the concurrency.

{% code overflow="wrap" %}

```shell
curl -X POST -H "Content-Type: application/json" -d '{"query":"query { piecesFlagged(hasUnsealedCopy: true, limit: 1000) { totalCount pieces { CreatedAt PieceCid IndexStatus { Status Error } } } }" }' http://localhost:8080/graphql/query | jq -rc ".data.piecesFlagged.pieces[]" | grep Registered | jq -r ".PieceCid" | xargs -P4 -L1 boostd lid gen-index
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boost.filecoin.io/tutorials/how-to-re-index-unsealed-pieces-that-are-flagged-by-lid-in-boost-v2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
