> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cyborg.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get

Retrieves items from the index by ID, with the fields you choose.

```go theme={null}
func (e *EncryptedIndex) Get(ctx context.Context, ids []string, include []string) (*GetResponse, error)
```

### Parameters

| Parameter | Type | Description |
| - | - | - |
| `ctx` | `context.Context` | Context for cancellation and deadlines. |
| `ids` | `[]string` | IDs of the items to retrieve. |
| `include` | `[]string` | Fields to return besides the ID. `nil` uses the service default, `{"vector", "contents", "metadata"}`. |

### Returns

`*GetResponse`, whose `Results` has one entry per ID found. IDs that don't exist are left out without an error, and an empty `ids` slice returns no results. When `include` doesn't contain `"vector"`, an existing item that has none of the requested fields is also left out.

| Field / method | Description |
| - | - |
| `Id string` | Always set. |
| `Vector []float32` | When `"vector"` is in `include`. |
| `GetContents() string` | When `"contents"` is in `include`. `""` if the item has no contents. |
| `Metadata map[string]interface{}` | When `"metadata"` is in `include`. Numbers decode as `float64`. |

### Errors

<AccordionGroup>
  <Accordion title="*AuthenticationError">
    The `apiKey` is invalid (HTTP `401`).
  </Accordion>

  <Accordion title="*ServiceError / *TransportError">
    The service returns `5xx` or can't be reached.
  </Accordion>
</AccordionGroup>

See [Errors](../errors).

### Example Usage

```go theme={null}
res, err := index.Get(ctx, []string{"doc1", "doc2", "missing-id"}, []string{"contents", "metadata"})
if err != nil {
    log.Fatal(err)
}

for _, item := range res.Results {
    fmt.Printf("%s %q %v\n", item.Id, item.GetContents(), item.Metadata)
}
// Output:
// doc1 "First document" map[]
// doc2 "" map[category:news]
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.