Pushes a batch of user behavior or attribute records to a data collection in an OpenSearch application.
Request syntax
POST /v3/openapi/app-groups/{appName}/data-collections/{dataCollectionName}/data-collection-type/{dataCollectionType}/actions/bulkPath parameters
| Parameter | Description |
|---|---|
appName | The name of the OpenSearch application. |
dataCollectionName | The name of the data collection. Defaults to the name of the OpenSearch application. |
dataCollectionType | The type of data to push. Valid values: USER, ITEM_INFO, BEHAVIOR, INDUSTRY_SPECIFIC. |
The endpoint and request header parameters are omitted from the URL above. For the complete request structure, see Request structure.
Request body
The request body is a JSON array passed as the value of the docs parameter.
| Parameter | Type | Required | Description |
|---|---|---|---|
docs | List | Yes | The list of documents to push. |
Each document object in the docs list contains the following parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
cmd | String | Yes | The operation to perform. Set to ADD. |
fields | Map | Yes | The fields of the document. The field schema must match the target table type. |
fields parameter
The fields value is a key-value map whose keys must match the schema of the target table. OpenSearch supports three table types: user tables, item tables, and behavior tables. For the field definitions of each table type, see Data collection 2.0.
Response elements
| Parameter | Type | Description |
|---|---|---|
errors | List | The error details. |
status | String | The result of the request. Valid values: OK (succeeded), FAIL (failed). If the request fails, troubleshoot errors based on the error code. |
request_id | String | The request ID. |
result | Boolean | Returns true for successful requests. Not returned for failed requests. |
Examples
Request
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"
}
}
]Response
{
"errors": [],
"request_id": "155084740119723291017595",
"status": "OK",
"result": true
}该文章对您有帮助吗?