Data Governance
Also available as:
PDF
loading table of contents...

DSL Search API

DSL Search that Returns Entities

Request:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query={dsl_query_string}

The dsl_query_string should be encoded using standard URL encoding criteria.

Response:

{
	"requestId": string,
	"query": dsl_query_string,
	"queryType": "dsl",
	"count": int,
	"results": array_of_search_results,
	"dataType": TypesDef struct
}

Response field descriptions:

  • query – The unencoded version of the dsl_query_string passed in the request.

  • queryType – The query type (dsl).

  • count – The number of results returned.

  • results – An array of search results. Each search result follows the EntityDefinition structure defined in Important Atlas API Datatypes, with the following differences:

    • The typeName attribute is changed to $typeName$

    • The id attribute is changed to $id$

  • dataType – A partial TypesDef Struct (defined in Important Atlas API Datatypes) that describes the search result type. The attribute definitions of the TypesDef are not complete.

Example Request:

The following example searches for an hbase_column_family where type='byte[]'.

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?hbase_column_family%2C+columns+where+type%3D%27byte%5B%5D%27

Example Response:

{
	"requestId": "qtp221036634-903 - 98091bba-9ea1-4482-9355-4dca396d9657",
	"query": "hbase_column_family, columns where type='byte[]'",
	"queryType": "dsl",
	"count": 2,
	"results": [{
		"$typeName$": "hbase_column",
		"$id$": {
			"id": "fc711cee-185f-4f09-a2f9-a96e0173f51b",
			"$typeName$": "hbase_column",
			"version": 0,
			"state": "ACTIVE"
		},
		"qualifiedName": "default.webtable.contents.html@cluster2",
		"type": "byte[]",
		"owner": "crawler",
		"description": null,
		"name": "html"
	}, {
		"$typeName$": "hbase_column",
		"$id$": {
			"id": "3a76cb82-544c-49d8-9f8c-eb12bcbc4584",
			"$typeName$": "hbase_column",
			"version": 0,
			"state": "ACTIVE"
		},
		"qualifiedName": "default.webtable.contents.html@cluster1",
		"type": "byte[]",
		"owner": "crawler",
		"description": null,
		"name": "html"
	}],
	"dataType": {
		"superTypes": ["Referenceable", "Asset"],
		"hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
		"typeName": "hbase_column",
		"typeDescription": null,
		"attributeDefinitions": [{
			"name": "type",
			"dataTypeName": "string",
			"multiplicity": {
				"lower": 1,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}]
	}
}

Because the results for the query are hbase_column instances, we see that the entity definition is an hbase_column.

DSL Search that Returns Specific Attributes

Request:

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query={dsl_query_string}

The dsl_query_string should be encoded using standard URL encoding criteria.

Response:

{
	"requestId": string,
	"query": dsl_query_string,
	"queryType": "dsl",
	"count": int,
	"results": [
			{
				“$typeName$”: “__tempQueryResultStruct..”,
				“selected_attribute_1”: “value”,
				...
			},
			...
],
	"dataType": {
				“typeName”: “__tempQueryResultStruct..”,
				"typeDescription": null,
				"attributeDefinitions": array of attributeDefinitions only for selected attributes
			}
}

Response field descriptions:

  • query – The unencoded version of the dsl_query_string passed in the request.

  • queryType – The query type (dsl).

  • count – The number of results returned.

  • results – An array of search results. Each search result follows the EntityDefinition structure defined in Important Atlas API Datatypes, with the following differences:

    • The typeName attribute is changed to $typeName$

    • The id attribute is changed to $id$

    • The result elements will contain only the attribute names and values specified in the query select clause.

    • The result elements will not include the GUID or any attribute that is not specified in the query select clause.

  • dataType – A partial TypesDef Struct (defined in Important Atlas API Datatypes) that describes the search result type. The attribute definitions of the TypesDef are not complete. The dataType includes only the attribute definitions for the attributes specified in the query select clause.

Example Request:

The following example searches for an hbase_table where name='webtable' select name, qualifiedName, isEnabled.

GET http://<atlas-server-host:port>/api/atlas/discovery/search/dsl?query=hbase_table+where+name%3D%27webtable%27+select+name%2C+qualifiedName%2C+isEnabled

Example Response:

{
	"requestId": "qtp221036634-963 - e8d615ee-1604-44db-8344-579c2fc3bbfe",
	"query": "hbase_table where name='webtable' select name, qualifiedName, isEnabled",
	"queryType": "dsl",
	"count": 2,
	"results": [{
		"$typeName$": "__tempQueryResultStruct89",
		"qualifiedName": "default.webtable@cluster2",
		"isEnabled": true,
		"name": "webtable"
	}, {
		"$typeName$": "__tempQueryResultStruct89",
		"qualifiedName": "default.webtable@cluster1",
		"isEnabled": false,
		"name": "webtable"
	}],
	"dataType": {
		"typeName": "__tempQueryResultStruct89",
		"typeDescription": null,
		"attributeDefinitions": [{
			"name": "name",
			"dataTypeName": "string",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "qualifiedName",
			"dataTypeName": "string",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}, {
			"name": "isEnabled",
			"dataTypeName": "boolean",
			"multiplicity": {
				"lower": 0,
				"upper": 1,
				"isUnique": false
			},
			"isComposite": false,
			"isUnique": false,
			"isIndexable": true,
			"reverseAttributeName": null
		}]
	}
}

Note that the response contains only the attributes name, qualifiedName and isEnabled. Also note that only these three attribute definitions are included.