ArangoXEcto.Migration.index
You're seeing just the function
index
, go back to ArangoXEcto.Migration module for more information.
Specs
index(String.t(), [String.t()], [index_option()]) :: ArangoXEcto.Migration.Index.t()
Creates an index struct
Default index type is a hash. To change this pass the :type
option in options.
Options
Options only apply to the creation of indexes and has no effect when using the drop/1
function.
:type
- The type of index to create- Accepts:
:fulltext
,:geo
,:hash
,:persistent
,:skiplist
or:ttl
- Accepts:
:unique
- If the index should be unique, defaults to false (hash, persistent & skiplist only):sparse
- If index should be spares, defaults to false (hash, persistent & skiplist only):deduplication
- If duplication of array values should be turned off, defaults to true (hash & skiplist only):minLength
- Minimum character length of words to index (fulltext only):geoJson
- If a geo-spatial index on a location is constructed and geoJson is true, then the order within the array is longitude followed by latitude (geo only):expireAfter
- Time in seconds after a document's creation it should count asexpired
(ttl only)
Examples
Create index on email field
iex> index("users", [:email])
%Index{collection_name: "users", fields: [:email]}
Create dual index on email and ph_number fields
iex> index("users", [:email, :ph_number])
%Index{collection_name: "users", fields: [:email, :ph_number]}
Create unique email index
iex> index("users", [:email], unique: true)
%Index{collection_name: "users", fields: [:email], [unique: true]}