如何通过其 HTTP API 在 ArangoDB 中创建哈希索引
HowTo create a hash index in ArangoDB via its HTTP API
我正在尝试通过其 HTTP API 通过 CURL 在 ArangoDB 中创建哈希索引。
在我的 ArangoDB 中,我有几个数据库,例如:
- 制作
- 分期
- 测试
如 https://docs.arangodb.com/3.4/HTTP/Indexes/Hash.html 中的文档中所述,应使用 URL 方案调用 "Index API",如下所示:
http://localhost:8529/_api/index?collection=products
应用于我的用例我有以下URL:
http://localhost:8529/_api/index?colletion=NodesElectric
执行 CURL 命令总是 returns 并出现如下错误:
{
"error": true,
"errorMessage": "collection or view not found",
"code": 404,
"errorNum": 1203
}
我想问题是由于在所有数据库 "production"、"staging"、...
中都有集合 "NodesElectric" 引起的
我的问题是如何为上述集合指定相应的数据库?
未在此处的文档中找到提示。
感谢您的帮助!
Any operation triggered via ArangoDB's HTTP REST API is executed in the context
of exactly one database. To explicitly specify the database in a
request, the request URI must contain the database name in front of
the actual path:
http://localhost:8529/_db/mydb/... where ... is the actual path to the
accessed resource. In the example, the resource will be accessed in
the context of the database mydb. Actual URLs in the context of mydb
could look like this:
可以在文档中找到此信息:
https://docs.arangodb.com/3.4/HTTP/Database/
如果请求中没有指定数据库URL,默认使用_system
数据库。
要在数据库 production
中的集合 NodesElectric
上创建哈希索引,必须使用以下 URL:
http://localhost:8529/_db/production/_api/index?collection=NodesElectric
我正在尝试通过其 HTTP API 通过 CURL 在 ArangoDB 中创建哈希索引。
在我的 ArangoDB 中,我有几个数据库,例如:
- 制作
- 分期
- 测试
如 https://docs.arangodb.com/3.4/HTTP/Indexes/Hash.html 中的文档中所述,应使用 URL 方案调用 "Index API",如下所示:
http://localhost:8529/_api/index?collection=products
应用于我的用例我有以下URL:
http://localhost:8529/_api/index?colletion=NodesElectric
执行 CURL 命令总是 returns 并出现如下错误:
{
"error": true,
"errorMessage": "collection or view not found",
"code": 404,
"errorNum": 1203
}
我想问题是由于在所有数据库 "production"、"staging"、...
中都有集合 "NodesElectric" 引起的我的问题是如何为上述集合指定相应的数据库?
未在此处的文档中找到提示。
感谢您的帮助!
Any operation triggered via ArangoDB's HTTP REST API is executed in the context of exactly one database. To explicitly specify the database in a request, the request URI must contain the database name in front of the actual path:
http://localhost:8529/_db/mydb/... where ... is the actual path to the accessed resource. In the example, the resource will be accessed in the context of the database mydb. Actual URLs in the context of mydb could look like this:
可以在文档中找到此信息:
https://docs.arangodb.com/3.4/HTTP/Database/
如果请求中没有指定数据库URL,默认使用_system
数据库。
要在数据库 production
中的集合 NodesElectric
上创建哈希索引,必须使用以下 URL:
http://localhost:8529/_db/production/_api/index?collection=NodesElectric