Area: API Issues
Sub-Area: Search Query Behavior
Applies to: OSS + Cloud
Issue
You search for one dataset by its qualified name, for example with /q qualifiedName:"<container>.<dataset>". The results include the exact match, but also other datasets whose names only partly match. After an upgrade, the same query can return a different set of results than before.
You Might Be Asking
- Why does my qualified name search return more results than expected?
- How can I get exact-match-only results for a qualified name?
- Did search behavior change between DataHub versions?
Cause
DataHub search is relevance search. It ranks results by how well they match. It is not an exact lookup.
A /q query runs your text as an Elasticsearch query string over the searchable fields. By default, DataHub also adds exact-match and prefix-match clauses to a /q query. A result only has to match one of these clauses to appear.
The search query and its ranking change between releases. For example, DataHub Cloud v2.0.0 made Search V2.5 the default search. So the same query can return different results after an upgrade.
Solution
To get only the dataset whose qualified name equals a value, use a filter instead of a search query. A filter with the EQUAL condition matches the stored value exactly, including case.
Run this GraphQL query. Replace <container>.<dataset> with the full qualified name, written with the same case as in DataHub:
query {
search(
input: {
type: DATASET
query: "*"
orFilters: [
{
and: [
{
field: "qualifiedName"
values: ["<container>.<dataset>"]
condition: EQUAL
}
]
}
]
start: 0
count: 10
}
) {
total
searchResults {
entity {
urn
... on Dataset {
name
properties {
qualifiedName
}
}
}
}
}
}
Use orFilters with values (a list). The older filters argument is deprecated. The results are under searchResults { entity { ... } }.
The Search guide shows more search examples with orFilters. The Advanced queries section of the same page covers the /q syntax.