Push collected data

更新时间:
复制 MD 格式

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/bulk

Path parameters

ParameterDescription
appNameThe name of the OpenSearch application.
dataCollectionNameThe name of the data collection. Defaults to the name of the OpenSearch application.
dataCollectionTypeThe 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.

ParameterTypeRequiredDescription
docsListYesThe list of documents to push.

Each document object in the docs list contains the following parameters.

ParameterTypeRequiredDescription
cmdStringYesThe operation to perform. Set to ADD.
fieldsMapYesThe 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

ParameterTypeDescription
errorsListThe error details.
statusStringThe result of the request. Valid values: OK (succeeded), FAIL (failed). If the request fails, troubleshoot errors based on the error code.
request_idStringThe request ID.
resultBooleanReturns 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
}