1

I want to store a document which would have a field containing a date. What would be the best way to represent it and which type should I use in its "search definition" ? I have looked for a "date" type in the documentation (https://docs.vespa.ai/documentation/reference/search-definitions-reference.html#field_types) but haven't found one.

dkurzaj
  • 346
  • 4
  • 13

1 Answers1

4

The best way to represent a date in Vespa is to use a unix timestamp.

The field definition in the search definition can be defined as:

# Creation date
field createdate type long {
    indexing: summary | attribute
    attribute: fast-search
}

Note that 'attribute' will make the value searchable, and 'attribute: fast-search' will improve the search performance