# Data type support

This page describes the data type support for vertices and edges.  
The following tables enumerate the data type support levels for  
vertex properties, properties of vertex properties, and edge properties.

## Supported vertex property data types

| Data type | Notes |
| --- | --- |
| Integer | Exact match or range search is supported when property is indexed. |
| Long | Exact match or range search is supported when property is indexed. |
| String | Index support is only for entire string. For example, the string `foobar` can only be indexed as `foobar` and cannot be found using substrings `foo` or `bar`. |
| List | Only homogenous scalar List types. Nesting is not allowed. Lists cannot be indexed. |
| Double | Cannot be indexed. |
| Boolean | Cannot be indexed. |
| Date | Exact match or range search is supported when property is indexed. Values must be in ISO-8601 format (for example, `YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS`, `YYYY-MM-DDTHH:MM:SSZ`). |

### Java example

```java
// Create vertex with string property.

final Vertex v1 = g.addV("person").property("name", "Foobar").next();

// Create vertex with integer property.

final Vertex v2 = g.addV("person").property("age", 29).next();

// Create vertex with long property.

final Vertex v3 = g.addV("person").property("age", 29L).next();

// Create vertex with double property.

final Vertex v4 = g.addV("person").property("age", 29.0).next();

// Create vertex with boolean property.

final Vertex v5 = g.addV("person").property("likesCoffee", true).next();

final List<String> places = new ArrayList<>();

places.add("Vancouver");

places.add("San Francisco");

places.add("Port Alberni");

places.add("Seattle");

// Create vertex with homogenous scalar arraylist property.

final Vertex v6 = g.addV("person").property("favoritePlaces", places).next();

// Create vertex with date property (using the required TinkerPop java.util.Date type).

final Vertex v7 = g.addV("person").property("birthDate", Date.from(LocalDate.parse("1995-03-10").atStartOfDay(ZoneOffset.UTC).toInstant())).next();
```

::: note
Depending on the record size configured in Aerospike, the maximum size and number of properties a vertex can store may vary. This can also change depending on how many edges are stored in the vertices edge cache.
:::

### Special considerations for Double values

While Double values are supported in Aerospike Graph, they are only recommended when the value is being stored and not used in a traversal query.

Double properties:

-   Cannot be secondary indexed
-   Do not support efficient predicate filtering using [P](https://tinkerpop.apache.org/docs/current/reference/#a-note-on-predicates)

#### Examples

##### Property indexing

```plaintext
aerospike.graph.index.vertex.properties=my_property

// Create secondary index on vertex property 'my_property'
```

```groovy
g.addV().property("my_property", 123.45).iterate()    // Stored as Double – not indexable

g.addV().property("my_property", 12345).iterate()     // Stored as Integer – indexed

g.addV().property("my_property", "myValue").iterate() // Stored as String – indexed

g.V().has("my_property", 123.45).next()               // Full query – property index not used

g.V().has("my_property", 12345).next()                // Uses property index

g.V().has("my_property", "myValue").next()            // Uses property index
```

##### Predicate filtering

```groovy
g.addV("v1").property("my_property", 50.5).iterate() // Create vertex "v1"

g.addV("v2").property("my_property", 37).iterate()   // Create vertex "v2"

g.V().has("my_property", P.gt(30)).toList()          // Returns [v2] — Optimized (integer match only)

g.V().has("my_property", P.gt(26.8)).toList()        // Returns [v1, v2] — Not optimized (includes both)
```

::: tip
If queries require range or predicate comparisons on numeric values, store those values as scaled Longs instead of Doubles. For example, rather than storing `36.7` as a Double, store `36700` as a Long by applying a scaling factor like `value * 1000` to preserve decimal precision..
:::

## Supported vertex metaproperty data types

| Data type |  |
| --- | --- |
| Integer |  |
| Long |  |
| String |  |
| List |  |
| Double |  |
| Boolean |  |
| Date |  |

::: note
Only homogenous scalar List types are allowed. Nesting of lists is not allowed. Vertex metaproperties cannot be indexed.
:::

### Java example

```java
// Add vertex metaproperty with string value.

final Vertex v1 = g.addV("device").property("type", "android", "lastUpdated", "yesterday").next();

// Add vertex metaproperty with integer value.

final Vertex v2 = g.addV("device").property("type", "ios", "version", 1).next();

// Add vertex metaproperty with long value.

final Vertex v3 = g.addV("device").property("type", "android", "version", 1L).next();

// Add vertex metaproperty with float value.

final Vertex v4 = g.addV("device").property("type", "windows", "version", 1.0).next();

// Add vertex metaproperty with boolean value.

final Vertex v5 = g.addV("device").property("type", "android", "isValid", false).next();

final List<String> places = new ArrayList<>();

places.add("Vancouver");

places.add("San Francisco");

places.add("Port Alberni");

places.add("Seattle");

// Add vertex metaproperty with list value.

final Vertex v6 = g.addV("device").property("type", "android", "placesVisited", places).next();

// Add vertex metaproperty with date value (using the required TinkerPop java.util.Date type).

final Vertex v7 = g.addV("device").property("type", "android", "manufacturedOn", Date.from(LocalDate.parse("2023-05-20").atStartOfDay(ZoneOffset.UTC).toInstant())).next();
```

## Supported edge property data types

| Data type |  |
| --- | --- |
| Integer |  |
| Long |  |
| String |  |
| List |  |
| Double |  |
| Boolean |  |
| Date |  |

::: note
Only homogenous scalar List types are allowed. Nesting of lists is not allowed. Edge properties cannot be indexed.
:::

### Java example

```java
// Create two vertices.

final Vertex v1 = g.addV("device").property("type", "ios").next();

final Vertex v2 = g.addV("device").property("type", "android").next();

// Create edge with string property.

final Edge e1 = g.addE("connected").from(v1).to(v2).property("since", "long time").next();

// Create edge with integer property.

final Edge e2 = g.addE("connected").from(v1).to(v2).property("forYears", 29).next();

// Create edge with long property.

final Edge e3 = g.addE("connected").from(v1).to(v2).property("forYears", 29L).next();

// Create edge with double property.

final Edge e4 = g.addE("connected").from(v1).to(v2).property("forYears", 29.0).next();

// Create edge with boolean property.

final Edge e5 = g.addE("connected").from(v1).to(v2).property("areFriends", true).next();

final List<String> places = new ArrayList<>();

places.add("Vancouver");

places.add("San Francisco");

places.add("Port Alberni");

places.add("Seattle");

// Create edge with homogenous scalar value list property.

final Edge e6 = g.addE("knows").from(v1).to(v2).property("connectedInPlaces", places).next();

// Create edge with date property (using the required TinkerPop java.util.Date type).

final Edge e7 = g.addE("connected").from(v1).to(v2).property("startedOn", Date.from(LocalDate.parse("2022-12-01").atStartOfDay(ZoneOffset.UTC).toInstant())).next();
```