ARANGODB ensureIndex 创建全文不起作用

ARANGODB ensureIndex to create full text not working

我在 ARANGODB 中插入了带有以下记录的事件集合。 (我是 Arango 的新手)

INSERT {
    "source": "ABC",
    "target": "ZYX",
    "tranno": "ABCDEF",
    "type": "REST",
    "attributes" : { "myID" : "12345"}
} INTO events

但是试图在属性上创建全文索引,导致如下所示的错误。如果你能帮上忙就太好了。

events.createIndex ({ type: "fulltext", fields: [ "attributes" ], minLength: 3 })

Query: AQL: syntax error, unexpected identifier near 'events.createIndex ({ type: "ful...' at position 1:1 (while parsing)

与SQL不同,AQL是一种用于数据选择和数据操作的语言。 它不是一种数据定义语言,因此您不能使用 AQL 创建索引。

要创建索引,请使用 ArangoDB 的 Web 界面(集合 => 目标集合 => 索引 => “+”图标)或 ArangoShell。 ArangoShell 是一个单独的可执行文件,随所有 ArangoDB 软件包一起提供。

在ArangoShell中你可以使用命令

db.events.createIndex ({ type: "fulltext", fields: [ "attributes" ], minLength: 3 })

创建索引。