MDIIndex implements IndexDefinition
Multi-dimensional index definition (`mdi` / `mdi-prefixed`).
Stable since ArangoDB 3.12. Indexes numeric (currently double) values across several attributes,
accelerating range queries like lat > x AND lng < y AND timestamp BETWEEN a AND b.
The resulting type is automatically resolved to IndexType::MDI_PREFIXED when $prefixFields is non-empty,
and IndexType::MDI otherwise.
Example:
$events->createIndex
(
new MDIIndex
(
fields : [ 'lat' , 'lng' , 'timestamp' ] ,
prefixFields : [ 'tenant' ] , // optional → mdi-prefixed
)
) ;
Tags
Table of Contents
Interfaces
- IndexDefinition
- Common contract for every index definition consumable by {@see \oihana\arango\clients\collection\Collection::createIndex()}.
Properties
- $estimates : bool|null
- $fields : array<string|int, mixed>
- $fieldValueTypes : string
- $inBackground : bool|null
- $name : string|null
- $prefixFields : array<string|int, mixed>|null
- $sparse : bool
- $storedValues : array<string|int, mixed>|null
- $unique : bool
Methods
- __construct() : mixed
- toArray() : array<string, mixed>
- Returns the request body for `POST /_api/index` corresponding to this index definition.
Properties
$estimates
public
bool|null
$estimates
= null
$fields
public
array<string|int, mixed>
$fields
$fieldValueTypes
public
string
$fieldValueTypes
= 'double'
$inBackground
public
bool|null
$inBackground
= null
$name
public
string|null
$name
= null
$prefixFields
public
array<string|int, mixed>|null
$prefixFields
= null
$sparse
public
bool
$sparse
= false
$storedValues
public
array<string|int, mixed>|null
$storedValues
= null
$unique
public
bool
$unique
= false
Methods
__construct()
public
__construct(array<int, string> $fields[, string $fieldValueTypes = 'double' ][, array<int, string>|null $prefixFields = null ][, bool $unique = false ][, bool $sparse = false ][, string|null $name = null ][, bool|null $estimates = null ][, array<int, string>|null $storedValues = null ][, bool|null $inBackground = null ]) : mixed
Parameters
- $fields : array<int, string>
-
Document attribute paths the index applies to (must hold numeric values matching
$fieldValueTypes). - $fieldValueTypes : string = 'double'
-
Numeric type stored for each indexed value (currently only
"double"is supported by the server). - $prefixFields : array<int, string>|null = null
-
Optional prefix attributes — when supplied, the index becomes
mdi-prefixed. - $unique : bool = false
-
Enforce uniqueness across indexed tuples.
- $sparse : bool = false
-
Skip documents missing every indexed attribute.
- $name : string|null = null
-
Optional human-readable index name.
- $estimates : bool|null = null
-
Maintain selectivity estimates for the query optimizer.
- $storedValues : array<int, string>|null = null
-
Additional attribute paths kept alongside the index entries.
- $inBackground : bool|null = null
-
Build the index in the background.
toArray()
Returns the request body for `POST /_api/index` corresponding to this index definition.
public
toArray() : array<string, mixed>