全部产品

CreateApp

更新时间:2020-09-10 18:56:29

描述

创建一个 opensearch 应用版本

  • 若已存在同名标准版应用,则创建新版本;
  • 在新建版本情况下,autoSwitchrealtimeShared 也是必填的;
  • 在新建版本情况下,quota 是自动从上一个版本继承的;
  • 在新建版本情况下,修改 quota 是无效的。

方法

POST

URI

/v4/openapi/app-groups/[appGroupIdentity]/apps?dryRun=true|false

请求参数

路径参数

字段 类型 是否必要 示例值 描述
appGroupIdentity String “my_app_group_name” 应用名称

查询参数

字段 类型 是否必要 示例值 描述
dryRun Boolean true 是否为空运行请求

请求体

字段 类型 是否必要 示例值 描述
type String “standard” 应用类型
- standard 标准版
- enhanced 高级版
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 查询意图理解规则配置详情
参考:QueryProcessor
summaries[] Object 搜索结果摘要设置
参考:Summary

返回参数

字段 类型 描述
requestId String 请求ID
result Object 版本信息
参考:App

示例

请求示例

  1. POST /v4/openapi/app-groups/os_function_test_v1/apps?dryRun=false
  1. {
  2. "type": "enhanced",
  3. "schema": {
  4. "indexes": {
  5. "searchFields": {
  6. "id": {
  7. "fields": [
  8. "id"
  9. ]
  10. },
  11. "default": {
  12. "fields": [
  13. "title"
  14. ],
  15. "analyzer": "chn_standard"
  16. },
  17. "cate_name": {
  18. "fields": [
  19. "cate_name"
  20. ]
  21. }
  22. },
  23. "filterFields": [
  24. "id",
  25. "buy",
  26. "cate_id",
  27. "cate_name"
  28. ]
  29. },
  30. "tables": {
  31. "main": {
  32. "name": "main",
  33. "fields": {
  34. "id": {
  35. "name": "id",
  36. "type": "LITERAL",
  37. "primaryKey": true
  38. },
  39. "title": {
  40. "name": "title",
  41. "type": "TEXT",
  42. "primaryKey": false
  43. },
  44. "buy": {
  45. "name": "buy",
  46. "type": "INT",
  47. "primaryKey": false
  48. },
  49. "cate_id": {
  50. "name": "cate_id",
  51. "type": "INT",
  52. "primaryKey": false
  53. },
  54. "cate_name": {
  55. "name": "cate_name",
  56. "type": "LITERAL",
  57. "primaryKey": false
  58. }
  59. },
  60. "primaryTable": true
  61. }
  62. },
  63. "routeField": ""
  64. },
  65. "dataSources": [{
  66. "tableName": "opensearch_table",
  67. "type": "rds",
  68. "fields": [{
  69. "id": "id"
  70. },
  71. {
  72. "title": "title"
  73. }
  74. ],
  75. "plugins": {
  76. "caption": {
  77. "name": "HTMLTagRemover",
  78. "parameters": {}
  79. },
  80. "content": {
  81. "name": "HTMLTagRemover",
  82. "parameters": {}
  83. }
  84. },
  85. "keyField": "id",
  86. "parameters": {
  87. "filter": "",
  88. "instanceId": "rm-bp1z7c93815m2256j",
  89. "dbName": "opensearch",
  90. "dbTableName": "opensearch_table",
  91. "dbUser": "test_12345",
  92. "dbPassword": "Test123456!",
  93. "autoSync": "true"
  94. }
  95. }],
  96. "firstRanks": [{
  97. "name": "first_rank_lsh_1",
  98. "description": "",
  99. "active": true,
  100. "meta": [{
  101. "attribute": "static_bm25()",
  102. "arg": "",
  103. "weight": 10
  104. },
  105. {
  106. "attribute": "exact_match_boost()",
  107. "arg": "",
  108. "weight": 20
  109. },
  110. {
  111. "attribute": "buy",
  112. "arg": "",
  113. "weight": 30
  114. }
  115. ]
  116. }],
  117. "secondRanks": [{
  118. "name": "lsh_second_1",
  119. "meta": "cate_id > 0 and cate_id < 1000",
  120. "active": true,
  121. "description": ""
  122. }],
  123. "summary": [{
  124. "name": "default",
  125. "meta": [{
  126. "field": "title",
  127. "len": 50,
  128. "element": "em",
  129. "ellipsis": "...",
  130. "snippet": 1
  131. }],
  132. "active": true
  133. }],
  134. "fetchFields": [
  135. "id",
  136. "title",
  137. "buy",
  138. "cate_id",
  139. "cate_name"
  140. ],
  141. "queryProcessors": [{
  142. "name": "sum_lsh_test_1",
  143. "domain": "GENERAL",
  144. "processors": [{
  145. "name": "stop_word",
  146. "useSystemDictionary": true,
  147. "interventionDictionary": ""
  148. },
  149. {
  150. "name": "spell_check",
  151. "useSystemDictionary": true,
  152. "interventionDictionary": ""
  153. },
  154. {
  155. "name": "term_weighting",
  156. "useSystemDictionary": true,
  157. "interventionDictionary": ""
  158. },
  159. {
  160. "name": "synonym",
  161. "useSystemDictionary": true,
  162. "interventionDictionary": ""
  163. }
  164. ],
  165. "indexes": [
  166. "default"
  167. ],
  168. "active": true,
  169. "id": "887512"
  170. }],
  171. "quota": {
  172. "computeResource": 20,
  173. "docSize": 1,
  174. "spec": "opensearch.share.common"
  175. }
  176. }

返回示例

正确返回

  1. {
  2. "requestId": "8664F6B7-9DD8-096A-FA3E-EBEE199EB94C",
  3. "result": {
  4. "id": "123456",
  5. "description": "",
  6. "status": "initializing",
  7. "fetchFields": [
  8. "id",
  9. "title",
  10. "buy",
  11. "cate_id",
  12. "cate_name"
  13. ],
  14. "type": "enhanced",
  15. "schema": {
  16. "tables": {
  17. "main": {
  18. "name": "main",
  19. "primaryTable": true,
  20. "fields": {
  21. "id": {
  22. "name": "id",
  23. "type": "LITERAL",
  24. "primaryKey": true
  25. },
  26. "title": {
  27. "name": "title",
  28. "type": "TEXT",
  29. "primaryKey": false
  30. },
  31. "buy": {
  32. "name": "buy",
  33. "type": "INT",
  34. "primaryKey": false
  35. },
  36. "cate_id": {
  37. "name": "cate_id",
  38. "type": "INT",
  39. "primaryKey": false
  40. },
  41. "cate_name": {
  42. "name": "cate_name",
  43. "type": "LITERAL",
  44. "primaryKey": false
  45. }
  46. }
  47. }
  48. },
  49. "indexes": {
  50. "searchFields": {
  51. "id": {
  52. "fields": [
  53. "id"
  54. ]
  55. },
  56. "default": {
  57. "fields": [
  58. "title"
  59. ],
  60. "analyzer": "chn_standard"
  61. },
  62. "cate_name": {
  63. "fields": [
  64. "cate_name"
  65. ]
  66. }
  67. },
  68. "filterFields": [
  69. "id",
  70. "buy",
  71. "cate_id",
  72. "cate_name"
  73. ]
  74. }
  75. },
  76. "algoDeploymentId": 0,
  77. "created": 0,
  78. "progressPercent": 0
  79. }
  80. }


错误返回
参考:响应结构