Skip to content

Fluent search

Today we're excited to release a simplified search experience via our SDKs, that we're calling "fluent search".

It is available today in:

  • Java SDK v1.1.0+
  • Python SDK v0.6.2+

Why?

If you are super search-savvy, you may already be familiar with Elastic and its power and flexibility. However, we understand not everyone has these skills — and for many of us having a basic and easy-to-use search mechanism can be desirable.

That's where fluent search comes in!

It's meant to be easy to learn, quick to do the basics, but also capable enough to address fairly powerful search use cases.

How does it work?

Fluent search is just a set of classes and methods over the same back-end APIs. So your queries will run as fast as ever, but defining them should now require less effort.

It'll probably help to look at a side-by-side comparison. Let's use one of our existing examples to illustrate. In this scenario, imagine you are searching for all assets that are marked as verified but are missing a description (suggesting they are in fact incomplete):

Before, without fluent search
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import static com.atlan.util.QueryFactory.*; // 

AtlanClient client = Atlan.getDefaultClient();
client.assets.all()
    .filter(where(KeywordFields.CERTIFICATE_STATUS).eq(CertificateStatus.VERIFIED)) // 
    .exclude(where(TextFields.DESCRIPTION).present())
    .exclude(where(TextFields.USER_DESCRIPTION).present())
    .attribute("ownerUsers") // 
    .attribute("ownerGroups")
    .stream()
    .forEach(a -> {
        log.info("Asset: {}", a);
    });
Now, with fluent search
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
AtlanClient client = Atlan.getDefaultClient();
client.assets.select()
    .where(Asset.CERTIFICATE_STATUS.eq(CertificateStatus.VERIFIED)) // 
    .whereNot(Asset.DESCRIPTION.hasAnyValue())
    .whereNot(Asset.USER_DESCRIPTION.hasAnyValue())
    .includeOnResults(Asset.OWNER_USERS) // 
    .includeOnResults(Asset.OWNER_GROUPS)
    .stream()
    .forEach(a -> {
        log.info("Asset: {}", a);
    });
Before, without fluent search
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.enums import CertificateStatus
from pyatlan.model.search import DSL, IndexSearchRequest, Term, Exists

client = AtlanClient()
verified_query = Term.with_certificate_status(CertificateStatus.VERIFIED)  # 
description_query = Exists.with_description()  # 
user_description_query = Exists.with_user_description()
compound_query = verified_query + ~description_query + ~user_description_query  # 
dsl = DSL(query=compound_query)  # 
find_assets = IndexSearchRequest(
    dsl=dsl,  # 
    attributes=[
        "ownerUsers",  # 
        "ownerGroups"
    ]
)
results = client.asset.search(find_assets)  # 
for asset in results:
    print(asset)
Now, with fluent search
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Asset
from pyatlan.model.enums import CertificateStatus
from pyatlan.model.fluent_search import FluentSearch

client = AtlanClient()
request = (
    FluentSearch()
    .where(Asset.CERTIFICATE_STATUS.eq(CertificateStatus.VERIFIED.value))  # 
    .where_not(Asset.DESCRIPTION.has_any_value())  # 
    .where_not(Asset.USER_DESCRIPTION.has_any_value())
    .include_on_results(Asset.OWNER_USERS)  # 
    .include_on_results(Asset.OWNER_GROUPS)
).to_request()  # 
for result in client.asset.search(request):  # 
    print(result)

Where to learn more

The various snippets, patterns and examples on the portal have all been updated to show off fluent search. To learn more specifically about search, check out:

We look forward to the use cases you'll unlock — do let us know any feedback! 🎉