Zen Indexes

Formal description of Zen Indexes in aidbox.index.v1. Read this guide first.

Index can be used to create any PostgreSQL index. Auto-index is auto-generated based on Zen SearchParameter.


Zen Index validation schema:

{ns aidbox.index.v1
 import #{aidbox.search-parameter.v1

 {:zen/tags #{zen/schema zen/tag}
  :zen/desc "Index definition for Aidbox V1"
  :type zen/map
  :require #{:table :expression :type}
  {:table {:type zen/string}
   :expression {:type zen/string}
   :type {:type zen/keyword
          :enum [{:value :gin}
                 {:value :btree}]}}}

 {:zen/tags #{zen/schema zen/tag}
  :zen/desc "Auto-generated index definition for Aidbox V1"
  :type zen/map
  :require #{:for}
  {:for {:type zen/symbol :tags #{aidbox.search-parameter.v1/search-parameter}}}}}

Index must contain:

  • table - name of the table

  • expression - SQL expression

  • type - two possible values: :gin or :btree

Auto-index must contain:

  • for - symbol with tag search-parameter

Last updated