Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

space_object:get()

space_object method get(key)

Search for a tuple in the given space.

Parameters:

  • space_object (space_object) — an object reference

  • key (scalar/table) — value to be matched against the index key, which may be multi-part.

Returns

the tuple whose index key matches key, or nil.

Return type

tuple

Possible errors:

  • space_object does not exist.
  • ER_TRANSACTION_CONFLICT if a transaction conflict is detected in the MVCC transaction mode.

Complexity factors: Index size, Index type, Number of indexes accessed, WAL settings.

The box.space...select function returns a set of tuples as a Lua table; the box.space...get function returns at most a single tuple. And it is possible to get the first tuple in a space by appending [1]. Therefore box.space.tester:get{1} has the same effect as box.space.tester:select{1}[1], if exactly one tuple is found.

Example:

box.space.tester:get{1}

Using field names instead of field numbers: [get()]{.title-ref} can use field names described by the optional /reference/reference_lua/box_space/format clause. This is true because the object returned by get() can be used with most of the features described in the /reference/reference_lua/box_tuple description, including /reference/reference_lua/box_tuple/field_name.

For example, we can format the [tester]{.title-ref} space with a field named [x]{.title-ref} and use the name [x]{.title-ref} in the index definition:

box.space.tester:format({{name='x',type='scalar'}})box.space.tester:create_index('I',{parts={'x'}})

Then, if get or select retrieves a single tuple, we can reference the field 'x' in the tuple by its name:

box.space.tester:get{1}['x']box.space.tester:select{1}[1]['x']