Creates a version for an OpenSearch application.

  • When you create a standard application, a new version of the application is created if the specified application name already exists.
  • When you create a version of an existing application, you must set the autoSwitch and realtimeShared parameters.
  • When you create a version of an existing application, the value of the quota parameter is the same as that of the quota parameter in the previous version of the application.
  • When you create a version of an existing application, the modification of the quota parameter does not take effect.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers. For more information, see Common request parameters.

Request syntax

POST /v4/openapi/app-groups/[appGroupIdentity]/apps HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
appGroupIdentity String Path Yes my_app_group_name

The name of the application.

dryRun Boolean Query No true

Specifies whether the request is a dry run.

Request body

Parameter

Type

Required

Example

Description

type

String

Yes

"standard"

The type of the application. Valid values:

  • standard: a standard application
  • enhanced: an advanced application

schema

Object

Yes

The schema of the new application version.

For more information, see Schema.

fetchFields

Array

Yes

["id", "name"]

The default display fields.

realtimeShared

Boolean

No

false

Specifies whether to synchronize real-time data between the online and offline versions of the application.

autoSwitch

Boolean

No

false

Specifies whether to automatically publish the new application version.

description

String

No

"demo"

The description of the new application version.

quota

Object

No

The information about the quotas of the new application version.

For more information, see Quota.

dataSources[]

Object

No

The details about data sources.

For more information, see DataSource.

firstRanks[]

Object

No

The details about rough sort expressions.

For more information, see FirstRank.

secondRanks[]

Object

No

The details about fine sort expressions.

For more information, see SecondRank.

queryProcessors[]

Object

No

The details about query analysis rules.

For more information, see QueryProcessor.

summaries[]

Object

No

The details about search result summaries.

For more information, see Summary.

Response parameters

Parameter Type Example Description
requestId String ABCDEFG

The ID of the request.

result Map {}

The result that was returned.

Examples

Sample requests

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"
    }
}

Sample success responses

XML format

<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 format

{
    "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
    }
}

Error codes

For a list of error codes, visit the API Error Center.