创建一个OpenSearch应用版本
- 若已存在同名标准版应用,则创建新版本;
- 在新建版本情况下,autoSwitch 和 realtimeShared 也是必填的;
- 在新建版本情况下,quota 是自动从上一个版本继承的;
- 在新建版本情况下,修改 quota 是无效的。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求头
该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。
请求语法
POST /v4/openapi/app-groups/[appGroupIdentity]/apps HTTP/1.1
请求参数
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|---|
appGroupIdentity | String | Path | 是 | my_app_group_name |
应用名称 |
dryRun | Boolean | Query | 否 | true |
是否为空运行请求 |
字段 |
类型 |
是否必要 |
示例值 |
描述 |
---|---|---|---|---|
type |
String |
是 |
"standard" |
应用类型
|
schema |
Object |
是 |
应用版本结构 参考:Schema |
|
fetchFields |
Array |
是 |
["id", "name"] |
默认展示字段 |
realtimeShared |
Boolean |
否 |
false |
是否共享实时流 |
autoSwitch |
Boolean |
否 |
false |
是否自动切上线 |
description |
String |
否 |
"demo" |
备注 |
quota |
Object |
否 |
版本配额信息 参考:Quota |
|
dataSources[] |
Object |
否 |
数据源详情 参考:DataSource |
|
firstRanks[] |
Object |
否 |
粗排表达式配置详情 参考:FirstRank |
|
secondRanks[] |
Object |
否 |
精排表达式配置详情 参考:SecondRank |
|
queryProcessors[] |
Object |
否 |
查询意图理解规则配置详情 |
|
summaries[] |
Object |
否 |
搜索结果摘要设置 参考:Summary |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
requestId | String | ABCDEFG |
请求ID |
result | Map | {} |
返回结果 |
示例
请求示例
POST /v4/openapi/app-groups/os_function_test_v1/apps?dryRun=false
{
"type": "enhanced",
"schema": {
"indexes": {
"searchFields": {
"id": {
"fields": [
"id"
]
},
"default": {
"fields": [
"title"
],
"analyzer": "chn_standard"
},
"cate_name": {
"fields": [
"cate_name"
]
}
},
"filterFields": [
"id",
"buy",
"cate_id",
"cate_name"
]
},
"tables": {
"main": {
"name": "main",
"fields": {
"id": {
"name": "id",
"type": "LITERAL",
"primaryKey": true
},
"title": {
"name": "title",
"type": "TEXT",
"primaryKey": false
},
"buy": {
"name": "buy",
"type": "INT",
"primaryKey": false
},
"cate_id": {
"name": "cate_id",
"type": "INT",
"primaryKey": false
},
"cate_name": {
"name": "cate_name",
"type": "LITERAL",
"primaryKey": false
}
},
"primaryTable": true
}
},
"routeField": ""
},
"dataSources": [{
"tableName": "opensearch_table",
"type": "rds",
"fields": [{
"id": "id"
},
{
"title": "title"
}
],
"plugins": {
"caption": {
"name": "HTMLTagRemover",
"parameters": {}
},
"content": {
"name": "HTMLTagRemover",
"parameters": {}
}
},
"keyField": "id",
"parameters": {
"filter": "",
"instanceId": "rm-abc",
"dbName": "opensearch",
"dbTableName": "opensearch_table",
"dbUser": "my_user",
"dbPassword": "my-passwrd",
"autoSync": "true"
}
}],
"firstRanks": [{
"name": "first_rank_lsh_1",
"description": "",
"active": true,
"type": "STRUCT",
"meta": [{
"attribute": "static_bm25()",
"arg": "",
"weight": 10
},
{
"attribute": "exact_match_boost()",
"arg": "",
"weight": 20
},
{
"attribute": "buy",
"arg": "",
"weight": 30
}
]
}],
"secondRanks": [{
"name": "lsh_second_1",
"meta": "cate_id > 0 and cate_id < 1000",
"active": true,
"description": ""
}],
"summary": [{
"name": "default",
"meta": [{
"field": "title",
"len": 50,
"element": "em",
"ellipsis": "...",
"snippet": 1
}],
"active": true
}],
"fetchFields": [
"id",
"title",
"buy",
"cate_id",
"cate_name"
],
"queryProcessors": [{
"name": "sum_lsh_test_1",
"domain": "GENERAL",
"processors": [{
"name": "stop_word",
"useSystemDictionary": true,
"interventionDictionary": ""
},
{
"name": "spell_check",
"useSystemDictionary": true,
"interventionDictionary": ""
},
{
"name": "term_weighting",
"useSystemDictionary": true,
"interventionDictionary": ""
},
{
"name": "synonym",
"useSystemDictionary": true,
"interventionDictionary": ""
}
],
"indexes": [
"default"
],
"active": true,
"id": "887512"
}],
"quota": {
"computeResource": 20,
"docSize": 1,
"spec": "opensearch.share.common"
}
}
正常返回示例
XML
格式
<requestId>8664F6B7-9DD8-096A-FA3E-EBEE199EB94C</requestId>
<result>
<id>123456</id>
<description/>
<status>initializing</status>
<fetchFields>id</fetchFields>
<fetchFields>title</fetchFields>
<fetchFields>buy</fetchFields>
<fetchFields>cate_id</fetchFields>
<fetchFields>cate_name</fetchFields>
<type>enhanced</type>
<schema>
<tables>
<main>
<name>main</name>
<primaryTable>true</primaryTable>
<fields>
<id>
<name>id</name>
<type>LITERAL</type>
<primaryKey>true</primaryKey>
</id>
<title>
<name>title</name>
<type>TEXT</type>
<primaryKey>false</primaryKey>
</title>
<buy>
<name>buy</name>
<type>INT</type>
<primaryKey>false</primaryKey>
</buy>
<cate_id>
<name>cate_id</name>
<type>INT</type>
<primaryKey>false</primaryKey>
</cate_id>
<cate_name>
<name>cate_name</name>
<type>LITERAL</type>
<primaryKey>false</primaryKey>
</cate_name>
</fields>
</main>
</tables>
<indexes>
<searchFields>
<id>
<fields>id</fields>
</id>
<default>
<fields>title</fields>
<analyzer>chn_standard</analyzer>
</default>
<cate_name>
<fields>cate_name</fields>
</cate_name>
</searchFields>
<filterFields>id</filterFields>
<filterFields>buy</filterFields>
<filterFields>cate_id</filterFields>
<filterFields>cate_name</filterFields>
</indexes>
</schema>
<algoDeploymentId>0</algoDeploymentId>
<created>0</created>
<progressPercent>0</progressPercent>
</result>
JSON
格式
{
"requestId": "8664F6B7-9DD8-096A-FA3E-EBEE199EB94C",
"result": {
"id": 123456,
"description": "",
"status": "initializing",
"fetchFields": [
"id",
"title",
"buy",
"cate_id",
"cate_name"
],
"type": "enhanced",
"schema": {
"tables": {
"main": {
"name": "main",
"primaryTable": true,
"fields": {
"id": {
"name": "id",
"type": "LITERAL",
"primaryKey": true
},
"title": {
"name": "title",
"type": "TEXT",
"primaryKey": false
},
"buy": {
"name": "buy",
"type": "INT",
"primaryKey": false
},
"cate_id": {
"name": "cate_id",
"type": "INT",
"primaryKey": false
},
"cate_name": {
"name": "cate_name",
"type": "LITERAL",
"primaryKey": false
}
}
}
},
"indexes": {
"searchFields": {
"id": {
"fields": "id"
},
"default": {
"fields": "title",
"analyzer": "chn_standard"
},
"cate_name": {
"fields": "cate_name"
}
},
"filterFields": [
"id",
"buy",
"cate_id",
"cate_name"
]
}
},
"algoDeploymentId": 0,
"created": 0,
"progressPercent": 0
}
}
错误码
访问错误中心查看更多错误码。