---
title: "Get operations"
description: "Aerospike Go client guide for List get operations including index, range, rank, value, and size retrieval."
---

# Get operations

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

#### `ListGetOp`: get by index

Retrieves a value by its index position. Supports negative indexing (-1 = last item).

```go
// Get first item (index 0)

record, err := client.Operate(nil, key,

    as.ListGetOp("tasks", 0),

)

firstTask := record.Bins["tasks"].(string)

fmt.Println("firstTask: ", firstTask)

// Get last item (index -1)

record, err = client.Operate(nil, key,

    as.ListGetOp("tasks", -1),

)
```

#### `ListGetRangeOp`: get range of items

Retrieves a range of items from the list.

```go
// Get first 10 items (from index 0, count 10)

record, err := client.Operate(nil, key,

    as.ListGetRangeOp("tasks", 0, 10),

)

results := record.Bins["tasks"].([]any)

firstTask := results[0].(string)
```

#### `ListGetByIndexOp`: get by index with return type

Similar to `ListGetOp` but with explicit return type control.

```go
// Get index of a value

record, err := client.Operate(nil, key,

    as.ListGetByIndexOp("items", 1, as.ListReturnTypeIndex)

)
```

#### `ListGetByRankOp`: get by rank

Retrieves an item by its rank (sorted by value).

```go
// Get item with lowest value (rank 0)

record, err := client.Operate(nil, key,

    as.ListGetByRankOp("scores", 0, as.ListReturnTypeValue),

)
```

#### `ListGetByValueOp`: Get by Value

Finds the index of items with a specific value.

```go
// Find index of value "target"

record, err := client.Operate(nil, key,

    as.ListGetByValueOp("items", "target", as.ListReturnTypeIndex),

)

indices := record.Bins["items"].([]any) // All indices where value appears
```

#### `ListSizeOp`: get list size

Returns the number of items in the list.

```go
// Get list size

record, err := client.Operate(nil, key,

    as.ListSizeOp("tasks"),

)

size := record.Bins["queue"].(int)

fmt.Printf("Queue has %d tasks\n", size)
```