@@ -68,33 +68,6 @@ def search_assets(
68
68
69
69
Raises:
70
70
Exception: If there's an error executing the search
71
-
72
- Examples:
73
- # Search for verified tables
74
- tables = search_assets(
75
- asset_type="Table",
76
- conditions={"certificate_status": CertificateStatus.VERIFIED.value}
77
- )
78
-
79
- # Search for assets missing descriptions
80
- missing_desc = search_assets(
81
- negative_conditions={
82
- "description": "has_any_value",
83
- "user_description": "has_any_value"
84
- },
85
- include_attributes=["owner_users", "owner_groups"]
86
- )
87
-
88
- # Search for columns with specific certificate status
89
- columns = search_assets(
90
- asset_type="Column",
91
- some_conditions={
92
- "certificate_status": [CertificateStatus.DRAFT.value, CertificateStatus.VERIFIED.value]
93
- },
94
- tags=["PRD"],
95
- conditions={"created_by": "username"},
96
- date_range={"create_time": {"gte": 1641034800000, "lte": 1672570800000}}
97
- )
98
71
"""
99
72
logger .info (
100
73
f"Starting asset search with parameters: asset_type={ asset_type } , "
@@ -414,79 +387,14 @@ def search_assets(
414
387
def get_assets_by_dsl (dsl_query : str ) -> Dict [str , Any ]:
415
388
"""
416
389
Execute the search with the given query
417
- dsl_query (required):
418
- The DSL object that is required to search the index.
419
-
420
- Example:
421
- dsl_query = '''{
422
- "query": {
423
- "function_score": {
424
- "boost_mode": "sum",
425
- "functions": [
426
- {"filter": {"match": {"starredBy": "john.doe"}}, "weight": 10},
427
- {"filter": {"match": {"certificateStatus": "VERIFIED"}}, "weight": 15},
428
- {"filter": {"match": {"certificateStatus": "DRAFT"}}, "weight": 10},
429
- {"filter": {"bool": {"must_not": [{"exists": {"field": "certificateStatus"}}]}}, "weight": 8},
430
- {"filter": {"bool": {"must_not": [{"terms": {"__typeName.keyword": ["Process", "DbtProcess"]}}]}}, "weight": 20}
431
- ],
432
- "query": {
433
- "bool": {
434
- "filter": [
435
- {
436
- "bool": {
437
- "minimum_should_match": 1,
438
- "must": [
439
- {"bool": {"should": [{"terms": {"certificateStatus": ["VERIFIED"]}}]}},
440
- {"term": {"__state": "ACTIVE"}}
441
- ],
442
- "must_not": [
443
- {"term": {"isPartial": "true"}},
444
- {"terms": {"__typeName.keyword": ["Procedure", "DbtColumnProcess", "BIProcess", "MatillionComponent", "SnowflakeTag", "DbtTag", "BigqueryTag", "AIApplication", "AIModel"]}},
445
- {"terms": {"__typeName.keyword": ["MCIncident", "AnomaloCheck"]}}
446
- ],
447
- "should": [
448
- {"terms": {"__typeName.keyword": ["Query", "Collection", "AtlasGlossary", "AtlasGlossaryCategory", "AtlasGlossaryTerm", "Connection", "File"]}},
449
- ]
450
- }
451
- }
452
- ]
453
- },
454
- "score_mode": "sum"
455
- },
456
- "score_mode": "sum"
457
- }
458
- },
459
- "post_filter": {
460
- "bool": {
461
- "filter": [
462
- {
463
- "bool": {
464
- "must": [{"terms": {"__typeName.keyword": ["Table", "Column"]}}],
465
- "must_not": [{"exists": {"field": "termType"}}]
466
- }
467
- }
468
- ]
469
- },
470
- "sort": [
471
- {"_score": {"order": "desc"}},
472
- {"popularityScore": {"order": "desc"}},
473
- {"starredCount": {"order": "desc"}},
474
- {"name.keyword": {"order": "asc"}}
475
- ],
476
- "track_total_hits": true,
477
- "size": 10,
478
- "include_meta": false
479
- }'''
480
- dsl_query = json.loads(dsl_query)
481
- response = get_assets_by_dsl(dsl_query)
482
-
390
+ Args:
391
+ dsl_query (required): The DSL object that is required to search the index.
392
+ Returns:
393
+ Dict[str, Any]: A dictionary containing the results and aggregations
483
394
"""
484
395
logger .info ("Starting DSL-based asset search" )
485
396
if logger .isEnabledFor (logging .DEBUG ):
486
- if isinstance (dsl_query , str ):
487
- # Only log a portion of the DSL string if it's too large
488
- log_query = dsl_query [:500 ] + "..." if len (dsl_query ) > 500 else dsl_query
489
- logger .debug (f"DSL query string: { log_query } " )
397
+ logger .debug ("Processing DSL query string" )
490
398
try :
491
399
# Parse string to dict if needed
492
400
if isinstance (dsl_query , str ):
0 commit comments