Search Data

查询指定数据类型下的数据对象,支持通过数据对象属性值、关联标签及标签属性、关联业务术语进行过滤。

请求格式

POST https://{apigw-address}/data-catalog/v2.0/entities/search

请求参数(URI)

名称 位置(Path/Query) 必需/可选 数据类型 描述
orgId Query 必需 String 组织 ID

请求参数(Body)

名称 必需/可选 数据类型 描述
typeId 必需 String 类型标识符(包括主数据和元数据)
pageNo 必需 Int 翻页参数,代表第几页(从 1 开始编号)
pageSize 必需 Int 翻页参数,代表每页返回数量
excludeDelete 可选 bool 是否排除已删除的数据对象(nebula 引擎版本该字段不生效,即不会返回已删除的对象。true 表示不返回已删除的对象,默认为 true。)
entityAttrFilters 可选 json
json 字符串,通过数据属性值进行过滤的参数。可支持多个属性过滤,不同数据对象类型支持过滤的属性如下:
  • DataSource : name
  • HiveTable : name
  • DTV Service: id , name
  • FileSet: id , name , fileType
  • Asset id: name, nameCn, nameEn, modelId, timezone
  • AssetTreeNode: assetId, assetName, modelId, treeId, parentAssetId
  • Measure: id, name
  • Business Term/Metric: 暂不支持属性过滤
  • 自定义主数据类型:用户定义的属性都支持过滤
tagAttrFilters 可选 json json 字符串,通过标签和标签属性值进行过滤的参数,仅支持单个标签过滤。
termFilters 可选 String 业务术语过滤条件。术语需带术语表信息,以 glossaryId:termId 格式传参,仅支持单个术语过滤。

entityAttrFilters

名称 必需/可选 数据类型 描述
condition 可选 String 枚举值:AND、OR
criterion 可选 jsonArray 筛选条件

criterion

名称 必需/可选 数据类型 描述
attributeName 可选 String 用于筛选的属性名
operator 可选 String
筛选操作。枚举值类型说明如下:
  • lt:小于
  • gt:大于
  • lte:小于等于
  • gte:大于等于
  • eq:等于
  • neq:不等于
  • contains:包含匹配
  • startsWith:前缀匹配
  • endsWith:后缀匹配

intshortlongfloatdoublebytedate 类型支持 [小于、大于、小于等于、大于等于、等于、不等于]。

String 类型支持 [等于、contains、startsWith、endsWith]。

bool 类型支持 [等于]。

attributeValue 可选 Object 用于筛选的属性值

tagAttrFilters

名称 必需/可选 数据类型 描述
tagId 可选 String 标签 ID
condition 可选 String 枚举值:AND、OR
criterion 可选 jsonArray 筛选条件

criterion

名称 必需/可选 数据类型 描述
attributeName 可选 String 用于筛选的属性名
operator 可选 String
筛选操作。枚举值类型说明如下:
  • lt:小于
  • gt:大于
  • lte:小于等于
  • gte:大于等于
  • eq:等于
  • neq:不等于
  • contains:包含匹配
  • startsWith:前缀匹配
  • endsWith:后缀匹配

intshortlongfloatdoublebytedate 类型支持 [小于, 大于, 小于等于, 大于等于, 等于, 不等于]。

String 类型支持 [等于,contains,startsWith,endsWith]。

bool 类型支持 [等于]。

attributeValue 可选 Object 用于筛选的属性值

响应参数

名称 数据类型 描述
data jsonArray 返回查询到的具体数据对象列表信息

data

名称 数据类型 描述
owner String 所有者
updatedTime timestamp 最后更新时间
createdBy String 创建者
name String 名称
guid String 系统中的唯一标识,数据对象 ID

示例

请求示例

url:    https://{apigw-address}/data-catalog/v2.0/entities/search?orgId=yourOrgId

method: POST

Content-Type: application/json

{
    "typeId": "UD_test",
    "pageNo": 1,
    "pageSize": 20,
    "excludeDelete": false,
    "entityAttrFilters": {
        "condition": "AND",
        "criterion": [{
            "attributeName": "height",
            "operator": "lt",
            "attributeValue": "70"
        }, {
            "attributeName": "turbineId",
            "operator": "=",
            "attributeValue": "ch9876"
        }]
    },
    "tagAttrFilters": {
        "tagId": "lc:lctag",
        "condition": "OR",
        "criterion": [{
            "attributeName": "attribute1",
            "operator": "lt",
            "attributeValue": 10
        }, {
            "attributeName": "attribute2",
            "operator": "gt",
            "attributeValue": 9.876
        }]
    },
    "termFilters":"test:test"
}

返回示例

{
    "code": 0,
    "message": "",
    "data": [{
                "owner": "testOwnerName",
                "updatedTime": null,
                "createdBy": "testOwnerName",
                "name": "风机1",
                "guid": "43ce1497-cbc5-4787-9b46-803297361ec6"
            },
            {
                "owner": "testOwnerName",
                "updatedTime": null,
                "createdBy": "testOwnerName",
                "name": "风机2",
                "guid": "43ce1497-cbc5-4787-9b46-803297361ec6"
            }
        ]
}

错误码

代码 错误信息
41001 参数[%s]不能为空。
41054 参数[%s]的值[%s]是不合法的。
41090 Atlas详细错误信息: %s
41131 Condition不合法:[%s],Condition支持AND和OR。
41132 Operator[%s]不合法:属性[%s]的operator支持[%s]。
41133 属性[%s]不存在或者不支持搜索。
42037 Tag[%s]属性[%s]的值与类型不匹配。
42039 属性[%s]的值与类型不匹配。
42052 [%s]类型不存在!
99000 服务器内部错误。