All Products
Search
Document Center

OpenSearch:Push collected data

Last Updated:Feb 03, 2023

Overview

You can call an API operation to push collected data to a specific application.

Supported HTTP request method

POST

URL

/v3/openapi/app-groups/{appName}/data-collections/{dataCollectionName}/data-collection-type/{dataCollectionType}/actions/bulk
  • Replace the appName parameter with the name of your OpenSearch application.

  • Replace the dataCollectionName parameter with the name of your collection of data to be pushed. By default, set this parameter to the name of your OpenSearch application.

  • Replace the dataCollectionType parameter with the type of your data to be pushed. Valid values: USER, ITEM_INFO, BEHAVIOR, and INDUSTRY_SPECIFIC.

  • The proceeding sample URL omits information such as parameters in the request header and the endpoint that is used to connect to OpenSearch. For more information about the complete request structure, see Request structure.

Request parameters

Parameter

Type

Required

Description

docs

List

Yes

A list of documents.

Document-related parameters

Parameter

Type

Required

Description

cmd

String

Yes

The operation to be performed on the documents. Set the value to ADD.

fields

Map

Yes

A collection of fields.

fields parameter

The value of the fields parameter is a collection of fields in a specific table. OpenSearch supports the following types of tables with different schemas: user tables, item tables, and behavior tables. For example, if you want to push data to a behavior table, the fields parameter must contain the fields that are defined in the behavior table. For more information, see the Data collection 2.0.

Parameter

Type

Required

Description

field1

xxx

Yes

A field in the specific table.

field2

xxx

Yes

A field in the specific table.

Response parameters

Parameter

Type

Description

errors

List

The error details.

status

String

The execution result of the request. Valid values: OK and FAIL. A value of OK indicates that the request is successful. A value of FAIL indicates that the request failed. In this case, troubleshoot errors based on the error code.

request_id

String

The ID of the request.

result

Boolean

The result of the request. A value of true is returned for successful requests. This parameter is not returned for failed requests.

Examples

Sample requests

POST /v3/openapi/app-groups/zhao_special/data-collections/zhao_special/data-collection-type/behavior/actions/bulk
[
  {
    "cmd": "ADD",
    "fields": {
        "sdk_type": "opensearch_sdk",
        "sdk_version": "3.2.0",
        "user_id": "10469628",
        "biz_id": 123,
        "trace_id": "231084198510103333",
        "item_id": "id",
        "item_type": "item",
        "bhv_type": "click",
        "reach_time": "20190730105931"
    }
  }
]

Sample success response

{
    "errors": [],
    "request_id": "155084740119723291017595",
    "status": "OK",
    "result": true
}