基本搜索允许您使用实体的类型名称,关联的分类/标记进行查询,并且支持对实体属性以及分类/标记属性进行过滤。
可以使用以下JSON结构(SearchParameters)表示整个查询结构:
{
"typeName": "hive_column",
"excludeDeletedEntities": true,
"classification": "PII",
"query": "",
"offset": 0,
"limit": 25,
"entityFilters": { },
"tagFilters": { },
"attributes": [ "table", "qualifiedName"]
}
字段解释
typeName: 要查找的实体类型
excludeDeletedEntities: 搜索是否应该排除已删除的实体? (默认值:true)
classification: 仅包括具有给定分类的实体
query: 实体应具有的任何自由文本出现(通用/通配符查询可能很慢)
offset: 结果集的起始偏移量(对分页有用)
limit: 要获取的最大结果数
entityFilters: 实体属性过滤器
tagFilters: 分类属性过滤器
attributes: 要包含在搜索结果中的属性
可以使用AND/OR条件对多个属性进行基于属性的过滤。
- 单个属性:
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"offset": 0,
"limit": 25,
"entityFilters": {
"attributeName": "name",
"operator": "contains",
"attributeValue": "customers"
},
"attributes": [ "db", "qualifiedName" ]
}
- 包含OR条件的多个属性
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"offset": 0,
"limit": 25,
"entityFilters": {
"condition": "OR",
"criterion": [
{
"attributeName": "name",
"operator": "contains",
"attributeValue": "customers"
},
{
"attributeName": "name",
"operator": "contains",
"attributeValue": "provider"
}
]
},
"attributes": [ "db", "qualifiedName" ]
}
- 包含AND条件的多个属性
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"offset": 0,
"limit": 25,
"entityFilters": {
"condition": "AND",
"criterion": [
{
"attributeName": "name",
"operator": "contains",
"attributeValue": "customers"
},
{
"attributeName": "owner",
"operator": "eq",
"attributeValue": "hive"
}
]
},
"attributes": [ "db", "qualifiedName" ]
}
- LT(操作符:<,lt)与Numeric,Date属性一起使用
- GT(操作符:>,gt)与Numeric,Date属性一起使用
- LTE(操作符:<=,lte)与Numeric,Date属性一起使用
- GTE(操作符:> =,gte)与Numeric,Date属性一起使用
- EQ(操作符:eq,=)与Numeric,Date,String属性一起使用
- NEQ(操作符:neq,!=)与Numeric,Date,String属性一起使用
- LIKE(操作符:like,LIKE)与String属性一起使用
- STARTS_WITH(symbols:startsWith,STARTSWITH)与String属性一起使用
- ENDS_WITH(symbols:endsWith,ENDSWITH)与String属性一起使用
- CONTAINS(操作符:contains,CONTAINS)与String属性一起使用
CURL示例
curl -sivk -g
-u <user>:<password>
-X POST
-d '{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"classification": "",
"query": "",
"offset": 0,
"limit": 50,
"entityFilters": {
"condition": "AND",
"criterion": [
{
"attributeName": "name",
"operator": "contains",
"attributeValue": "customers"
},
{
"attributeName": "owner",
"operator": "eq",
"attributeValue": "hive"
}
]
},
"attributes": [ "db", "qualifiedName" ]
}'
<protocol>://<atlas_host>:<atlas_port>/api/atlas/v2/search/basic