我正在尝试在特定命名空间下的集合中创建索引,但不确定如何操作。
我的资源有一个 HTTP 示例:
POST /example/v1/index/{namespace}/{set}/{indexName}
对于示例输入:
{
"fields": [
{ "indexField": "firstName", "indexReverseOrder": true },
{ "indexField": "lastName" }
],
"options": {
"isUnique": true
}
}
这消耗
application/json;charset=UTF-8
但是当我把它写成
curl -X POST exampleurl.com/example/v1/index/example_namespace/example_set/example
set -d " {
"fields": [
{ "indexField": "firstName", "indexReverseOrder": true },
{ "indexField": "lastName" }
],
"options": {
"isUnique": true
} }" -H "Content-type : application/json;charset=UTF-8"
我得到以下 HTTP 状态代码
HTTP/1.1 415 Unsupported Media Type
谁能向我解释发生了什么以及如何解决这个问题?另外,如果您没有足够的有关 API 的信息来理解它,请告诉我,谢谢!
编辑:
作为某种参考,对于这个 API,当我在命名空间中创建一个集合时,我会这样做:
curl -X POST http://exampleurl.com/example/v1/store/example_namespace -d "example_set" -H "Content-type: application/json;charset=UTF-8"
这是成功的。我认为索引会与此类似,但显然不是。